Class: Crumbs::Controller

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

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ Controller

Returns a new instance of Controller.



4
5
6
# File 'lib/crumbs/controller.rb', line 4

def initialize(controller)
  @controller = controller
end

Instance Method Details

#action(action, name = nil, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/crumbs/controller.rb', line 8

def action(action, name=nil, &block)
  controller = @controller.to_s
  action = action.to_s
  name = (block_given? ? block : name)
  all = Crumbs.all
  if all.has_key? controller
    all[controller][action] = name
  else
    all[controller] = { action => name }
  end
end