Module: Utopia::Controller::Actions::ClassMethods
- Defined in:
- lib/utopia/controller/actions.rb
Instance Method Summary collapse
- #actions ⇒ Object
- #dispatch(controller, request, path) ⇒ Object
- #on(first, *path, **options, &block) ⇒ Object
Instance Method Details
#actions ⇒ Object
115 116 117 |
# File 'lib/utopia/controller/actions.rb', line 115 def actions @actions ||= Action.new end |
#dispatch(controller, request, path) ⇒ Object
127 128 129 130 131 132 133 |
# File 'lib/utopia/controller/actions.rb', line 127 def dispatch(controller, request, path) if @actions @actions.apply(path.components) do |action| controller.instance_exec(request, path, &action.callback) end || controller.otherwise(request, path) end end |
#on(first, *path, **options, &block) ⇒ Object
119 120 121 122 123 124 125 |
# File 'lib/utopia/controller/actions.rb', line 119 def on(first, *path, **, &block) if first.is_a? Symbol first = ['**', first.to_s] end actions.define(Path.split(first) + path, , &block) end |