module Law::Laws::Judgements

Public Instance Methods

authorize(action) click to toggle source
# File lib/law/laws/judgements.rb, line 23
def authorize(action)
  judgement(action).tap(&:judge)
end
authorize!(action) click to toggle source
# File lib/law/laws/judgements.rb, line 27
def authorize!(action)
  judgement(action).tap(&:judge!)
end
authorized?(action) click to toggle source
# File lib/law/laws/judgements.rb, line 31
def authorized?(action)
  judgement(action).judge
end
define_judgement_predicates_for_action(action) click to toggle source
# File lib/law/laws/judgements.rb, line 12
def define_judgement_predicates_for_action(action)
  method_name = "#{action}?".to_sym
  define_method(method_name) { authorized?(action) }
  define_singleton_method(method_name) { |**options| new(**options).public_send(method_name) }
end
judgement(action) click to toggle source
# File lib/law/laws/judgements.rb, line 19
def judgement(action)
  Law::Judgement.new(petition_for_action(action))
end