Class: CanTango::Executor::PermitType
- Defined in:
- lib/cantango/executor/permit_type.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
- #execute! ⇒ Object
-
#initialize(ability, permit_type, permits) ⇒ PermitType
constructor
A new instance of PermitType.
Constructor Details
#initialize(ability, permit_type, permits) ⇒ PermitType
Returns a new instance of PermitType.
9 10 11 12 13 |
# File 'lib/cantango/executor/permit_type.rb', line 9 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.
7 8 9 |
# File 'lib/cantango/executor/permit_type.rb', line 7 def ability @ability end |
#permit_type ⇒ Object (readonly) Also known as: cache_key
Returns the value of attribute permit_type.
7 8 9 |
# File 'lib/cantango/executor/permit_type.rb', line 7 def permit_type @permit_type end |
#permits ⇒ Object (readonly)
Returns the value of attribute permits.
7 8 9 |
# File 'lib/cantango/executor/permit_type.rb', line 7 def permits @permits end |
Instance Method Details
#cache ⇒ Object
17 18 19 |
# File 'lib/cantango/executor/permit_type.rb', line 17 def cache @cache ||= CanTango::Ability::Cache.new self, :cache_key => cache_key, :key_method_names => key_method_names end |
#execute! ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/cantango/executor/permit_type.rb', line 21 def execute! # 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 |