Module: Lotus::Controller::Dsl::ClassMethods
- Defined in:
- lib/lotus/controller/dsl.rb
Overview
Instance Method Summary collapse
-
#action(name, &blk) ⇒ Object
Define an action for the given name.
Instance Method Details
#action(name, &blk) ⇒ Object
Define an action for the given name. It generates a concrete class for the action, for this reason the name MUST be a valid name for Ruby.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/lotus/controller/dsl.rb', line 43 def action(name, &blk) config = configuration.duplicate const_set(name, Class.new) const_get(name).tap do |klass| klass.class_eval { include config.action_module } klass.configuration = config klass.class_eval(&blk) end end |