class PolicyManager::Rule

Attributes

blocking[RW]
if[RW]
name[RW]
on_accept[RW]
on_reject[RW]
validates_on[RW]

Public Class Methods

new(opts={}) click to toggle source
# File lib/policy_manager/rule.rb, line 10
def initialize(opts={})
  self.name = opts[:name]
  self.blocking = opts[:blocking]
  self.validates_on = opts[:validates_on]
  self.if = opts[:if]
  self.on_reject = opts[:on_reject]
  self.on_accept = opts[:on_accept]
  self
end

Public Instance Methods

on_accept_callback() click to toggle source
# File lib/policy_manager/rule.rb, line 32
def on_accept_callback
  @on_accept.call if @on_accept.is_a?(Proc)
end
on_reject_callback() click to toggle source
# File lib/policy_manager/rule.rb, line 28
def on_reject_callback
  @on_reject.call if @on_reject.is_a?(Proc)
end
terms() click to toggle source
# File lib/policy_manager/rule.rb, line 24
def terms
  Term.where("rule =?", self.name)
end