Class: ActionDispatch::Routing::RouteSet::Dispatcher

Inherits:
Endpoint
  • Object
show all
Defined in:
lib/action_dispatch/routing/route_set.rb

Direct Known Subclasses

StaticDispatcher

Instance Method Summary collapse

Methods inherited from Endpoint

#app, #engine?, #matches?, #rack_app, #redirect?

Constructor Details

#initialize(raise_on_name_error) ⇒ Dispatcher

Returns a new instance of Dispatcher.



40
41
42
# File 'lib/action_dispatch/routing/route_set.rb', line 40

def initialize(raise_on_name_error)
  @raise_on_name_error = raise_on_name_error
end

Instance Method Details

#dispatcher?Boolean

Returns:

  • (Boolean)


44
# File 'lib/action_dispatch/routing/route_set.rb', line 44

def dispatcher?; true; end

#serve(req) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/action_dispatch/routing/route_set.rb', line 46

def serve(req)
  params     = req.path_parameters
  controller = controller req
  res        = controller.make_response! req
  dispatch(controller, params[:action], req, res)
rescue ActionController::RoutingError
  if @raise_on_name_error
    raise
  else
    [404, { Constants::X_CASCADE => "pass" }, []]
  end
end