Module: Canable

Defined in:
lib/canable.rb

Defined Under Namespace

Modules: Ables, Cans, Enforcers Classes: Transgression

Constant Summary collapse

Version =
'0.2.0'

Class Method Summary collapse

Class Method Details

.actionsObject

Returns hash of actions that have been added.

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


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

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.


42
43
44
45
46
47
# File 'lib/canable.rb', line 42

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

.cansObject



34
35
36
# File 'lib/canable.rb', line 34

def self.cans
  actions.keys
end