Class: NestedModelAuth::AuthorizationRule

Inherits:
Object
  • Object
show all
Defined in:
lib/nested_model_auth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_action, &block) ⇒ AuthorizationRule

Returns a new instance of AuthorizationRule.



9
10
11
12
# File 'lib/nested_model_auth.rb', line 9

def initialize(auth_action, &block)
  @auth_action = auth_action
  @block = block
end

Instance Attribute Details

#auth_actionObject

Returns the value of attribute auth_action.



7
8
9
# File 'lib/nested_model_auth.rb', line 7

def auth_action
  @auth_action
end

#blockObject

Returns the value of attribute block.



7
8
9
# File 'lib/nested_model_auth.rb', line 7

def block
  @block
end

Instance Method Details

#invoke_for(model, resource) ⇒ Object



14
15
16
# File 'lib/nested_model_auth.rb', line 14

def invoke_for(model, resource)
  model.instance_exec(resource, &@block)
end