Module: Canable
- Defined in:
- lib/canable.rb,
lib/canable/cans.rb,
lib/canable/role.rb,
lib/canable/actor.rb,
lib/canable/canable.rb,
lib/canable/enforcers.rb
Defined Under Namespace
Modules: Ables, Actor, Cans, Enforcers, Role, Roles Classes: Transgression
Constant Summary collapse
- Version =
'0.2.2'
Class Method Summary collapse
-
.actions ⇒ Object
Returns hash of actions that have been added.
-
.add(can, able) ⇒ Object
Adds an action to actions and the correct methods to can and able modules.
- .run_callbacks(callback, options) ⇒ Object
Class Method Details
.actions ⇒ Object
Returns hash of actions that have been added.
{:view => :viewable, ...}
26 27 28 |
# File 'lib/canable/canable.rb', line 26 def self.actions @actions end |
.add(can, able) ⇒ Object
Adds an action to actions and the correct methods to can and able modules.
@param [Symbol] can_method The name of the can_[action]? method.
@param [Symbol] resource_method The name of the [resource_method]_by? method.
34 35 36 37 38 39 |
# File 'lib/canable/canable.rb', line 34 def self.add(can, able) @actions[can] = able add_can_method(can) add_able_method(can, able) add_enforcer_method(can) end |
.run_callbacks(callback, options) ⇒ Object
41 42 43 |
# File 'lib/canable/canable.rb', line 41 def self.run_callbacks(callback, ) @callbacks.run_callbacks(callback, ) { |result, object| result == false } end |