Module: Hara::App::ClassMethods

Defined in:
lib/hara/app.rb

Instance Method Summary collapse

Instance Method Details

#define_action(action, &block) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/hara/app.rb', line 23

def define_action action, &block
  action = action.to_s
  warn "Action #{action} duplication defined" if Actions.has_key? action
  Hara::Application.send :define_method, action, &block
  method = Hara::Application.send :instance_method, action
  Hara::Application.send :remove_method, action
  Actions[action] = method
end