8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/wayfarer/middleware/dispatch.rb', line 8
def call(task)
controller = task[:controller]
task[:return_value] = controller.run_callbacks(:action) do
case action = task[:action]
when Symbol then controller.public_send(action)
when Array
handler, method = action
task[:action] = method
handler.new.call(task)
else
raise ArgumentError, "invalid action: #{action.inspect}" unless action&.include?(Wayfarer::Handler)
task[:action] = nil action.new.call(task)
end
end
yield if block_given?
end
|