Class: CanTango::Ability::Base
- Inherits:
-
Object
- Object
- CanTango::Ability::Base
- Includes:
- CanCan::Ability, Rules
- Defined in:
- lib/cantango/ability/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#candidate ⇒ Object
readonly
Returns the value of attribute candidate.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(candidate, options = {}) ⇒ Base
constructor
Equivalent to a CanCan Ability#initialize call which executes all the permission logic.
- #session ⇒ Object
Methods included from Rules
#calculate_rules, #clear_rules!, #default_rules, #normalize_rules!, #rules
Constructor Details
#initialize(candidate, options = {}) ⇒ Base
Equivalent to a CanCan Ability#initialize call which executes all the permission logic
11 12 13 14 15 |
# File 'lib/cantango/ability/base.rb', line 11 def initialize candidate, = {} raise "Candidate must be something!" if !candidate @candidate, @options = candidate, execute end |
Instance Attribute Details
#candidate ⇒ Object (readonly)
Returns the value of attribute candidate.
7 8 9 |
# File 'lib/cantango/ability/base.rb', line 7 def candidate @candidate end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/cantango/ability/base.rb', line 7 def @options end |
Instance Method Details
#execute ⇒ Object
17 18 19 20 |
# File 'lib/cantango/ability/base.rb', line 17 def execute clear_rules! calculate_rules end |
#session ⇒ Object
22 23 24 |
# File 'lib/cantango/ability/base.rb', line 22 def session @session ||= [:session] || {} # seperate session cache for each type of user? end |