Module: Canable

Defined in:
lib/canable.rb

Defined Under Namespace

Modules: Ables, Cans, Enforcers Classes: Transgression

Constant Summary collapse

Version =
'0.1'

Class Method Summary collapse

Class Method Details

.actionsObject

Returns hash of actions that have been added.

{:view => :viewable, ...}


31
32
33
# File 'lib/canable.rb', line 31

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.


39
40
41
42
43
44
# File 'lib/canable.rb', line 39

def self.add(can, able)
  @actions[can] = able
  add_can_method(can, able)
  add_able_method(able)
  add_enforcer_method(can)
end