Module: TShield::Controller::ClassMethods

Defined in:
lib/tshield/controller.rb

Instance Method Summary collapse

Instance Method Details

#action(class_method, options) ⇒ Object



11
12
13
14
# File 'lib/tshield/controller.rb', line 11

def action(class_method, options)
  @@actions = {} unless defined? @@actions
  @@actions[class_method] = options
end

#registered(app) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/tshield/controller.rb', line 16

def registered(app)
  @@actions.each do |class_method, options|
    puts "== registering #{options[:path]} for methods #{options[:methods].join(',')} with action #{class_method}"
    options[:methods].each do |method|
      app.send(method, options[:path]) { send(class_method, params, request) }
    end
  end
end