Class: ActionGuard::AllowRule

Inherits:
Object
  • Object
show all
Defined in:
lib/action-guard/rules.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ AllowRule

Returns a new instance of AllowRule.



30
31
32
# File 'lib/action-guard/rules.rb', line 30

def initialize(&block)
  @additional_rule = block
end

Instance Method Details

#allows?(person, request_params) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
36
# File 'lib/action-guard/rules.rb', line 33

def allows?(person, request_params)
  return @additional_rule.call(person, request_params) unless @additional_rule.nil?
  true
end