Class: Crumbs::Definitions

Inherits:
Object
  • Object
show all
Defined in:
lib/crumbs/definitions.rb

Class Method Summary collapse

Class Method Details

.add(controller, action, name) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/crumbs/definitions.rb', line 9

def add(controller, action, name)
  if all.has_key? controller
    all[controller][action] = name
  else
    all[controller] = { action => name }
  end
end

.allObject



5
6
7
# File 'lib/crumbs/definitions.rb', line 5

def all
  @all ||= {}
end

.find(controller, action, params) ⇒ Object



17
18
19
20
21
22
# File 'lib/crumbs/definitions.rb', line 17

def find(controller, action, params)
  if all.has_key? controller and all[controller].has_key? action
    name = all[controller][action]
    name.is_a?(Proc) ? name.call(params) : name
  end
end