Module: Canable

Defined in:
lib/canable.rb,
lib/canable/version.rb

Defined Under Namespace

Modules: Ables, Cans, Enforcers Classes: Transgression

Constant Summary collapse

VERSION =
'0.3.0'

Class Method Summary collapse

Class Method Details

.actionsObject

Returns hash of actions that have been added.

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


28
29
30
# File 'lib/canable.rb', line 28

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.


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

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

.cansObject



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

def self.cans
  actions.keys
end