module TShield::Controller::ClassMethods

Implementation of actions

Public Instance Methods

action(class_method, options) click to toggle source
# File lib/tshield/controller.rb, line 16
def action(class_method, options)
  @actions = {} unless defined? @actions
  @actions[class_method] = options
end
load_action(app, class_method, options) click to toggle source
# File lib/tshield/controller.rb, line 27
def load_action(app, class_method, options)
  msg = "== registering #{options[:path]}"
  msg << " for methods #{options[:methods].join(',')}"
  msg << " with action #{class_method}"

  TShield.logger.info(msg)
  options[:methods].each do |method|
    app.send(method, options[:path]) do
      send(class_method, params, request)
    end
  end
end
registered(app) click to toggle source
# File lib/tshield/controller.rb, line 21
def registered(app)
  @actions.each do |class_method, options|
    load_action(app, class_method, options)
  end
end