Class: CanTango::Ability::Mode::Base
- Inherits:
-
Object
- Object
- CanTango::Ability::Mode::Base
- Includes:
- Executor
- Defined in:
- lib/cantango/ability/mode/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#ability ⇒ Object
readonly
Returns the value of attribute ability.
Attributes included from Helpers::Debug
Instance Method Summary collapse
-
#initialize(ability, options = {}) ⇒ Base
constructor
A new instance of Base.
- #valid? ⇒ Boolean
- #within_callbacks ⇒ Object
Methods included from Executor
Methods included from Callbacks
Methods included from Helpers::Debug
Methods included from Rules
#calculate_rules, #clear_rules!, #default_rules, #normalize_rules!, #rules
Constructor Details
#initialize(ability, options = {}) ⇒ Base
Returns a new instance of Base.
14 15 16 |
# File 'lib/cantango/ability/mode/base.rb', line 14 def initialize ability, = {} @ability, @options = [ability, ] end |
Instance Attribute Details
#ability ⇒ Object (readonly)
Returns the value of attribute ability.
9 10 11 |
# File 'lib/cantango/ability/mode/base.rb', line 9 def ability @ability end |
Instance Method Details
#valid? ⇒ Boolean
26 27 28 |
# File 'lib/cantango/ability/mode/base.rb', line 26 def valid? true end |
#within_callbacks ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/cantango/ability/mode/base.rb', line 18 def within_callbacks handle_callbacks :before raise CanTango::Ability::Mode::InvalidError, "Not valid mode: #{self.class}" if !valid? yield handle_callbacks :after rules end |