Class: CanTango::Ability::Mode::Base
- Inherits:
-
Object
- Object
- CanTango::Ability::Mode::Base
- 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 Builder
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.
15 16 17 |
# File 'lib/cantango/ability/mode/base.rb', line 15 def initialize ability, = {} @ability, @options = [ability, ] end |
Instance Attribute Details
#ability ⇒ Object (readonly)
Returns the value of attribute ability.
10 11 12 |
# File 'lib/cantango/ability/mode/base.rb', line 10 def ability @ability end |
Instance Method Details
#valid? ⇒ Boolean
27 28 29 |
# File 'lib/cantango/ability/mode/base.rb', line 27 def valid? true end |
#within_callbacks ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/cantango/ability/mode/base.rb', line 19 def within_callbacks handle_callbacks :before raise CanTango::Ability::Mode::InvalidError, "Not valid mode: #{self.class}" if !valid? yield handle_callbacks :after rules end |