Class: CanTango::Permits::Executor
- Inherits:
-
Object
- Object
- CanTango::Permits::Executor
- Includes:
- Ability::Executor
- Defined in:
- lib/cantango/permits/executor.rb
Instance Attribute Summary collapse
-
#ability ⇒ Object
readonly
Returns the value of attribute ability.
-
#permit_type ⇒ Object
(also: #cache_key)
readonly
Returns the value of attribute permit_type.
-
#permits ⇒ Object
readonly
Returns the value of attribute permits.
Instance Method Summary collapse
- #cache ⇒ Object
-
#initialize(ability, permit_type, permits) ⇒ Executor
constructor
A new instance of Executor.
- #permit_rules ⇒ Object
Methods included from Ability::Executor
#clear_rules!, #engine_name, #execute!, #rules
Methods included from Helpers::RoleMethods
#config, #has_role_group_meth, #has_role_meth, #role_groups_list_meth, #roles_list_meth
Methods included from Helpers::Debug
Constructor Details
#initialize(ability, permit_type, permits) ⇒ Executor
Returns a new instance of Executor.
11 12 13 14 15 |
# File 'lib/cantango/permits/executor.rb', line 11 def initialize ability, permit_type, permits @ability = ability @permit_type = permit_type @permits = permits end |
Instance Attribute Details
#ability ⇒ Object (readonly)
Returns the value of attribute ability.
9 10 11 |
# File 'lib/cantango/permits/executor.rb', line 9 def ability @ability end |
#permit_type ⇒ Object (readonly) Also known as: cache_key
Returns the value of attribute permit_type.
9 10 11 |
# File 'lib/cantango/permits/executor.rb', line 9 def permit_type @permit_type end |
#permits ⇒ Object (readonly)
Returns the value of attribute permits.
9 10 11 |
# File 'lib/cantango/permits/executor.rb', line 9 def permits @permits end |
Instance Method Details
#cache ⇒ Object
19 20 21 |
# File 'lib/cantango/permits/executor.rb', line 19 def cache @cache ||= CanTango::Ability::Cache.new self, :cache_key => cache_key, :key_method_names => key_method_names end |
#permit_rules ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/cantango/permits/executor.rb', line 23 def permit_rules # TODO: somehow type specific caching of result of permits! permits.each do |permit| CanTango.config.permits.was_executed(permit, ability) if CanTango.debug? break if permit.execute == :break end end |