# frozen_string_literal: true module Wayfarer module Middleware class Dispatch extend Base def call(task) controller = task.metadata.controller controller.run_callbacks(:action) do case action = task.metadata.action when Symbol then controller.public_send(action) else action.new.call(task) end end yield if block_given? end end end end