123456789_123456789_123456789_123456789_123456789_

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

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: ActionDispatch::Routing::Endpoint
Defined in: actionpack/lib/action_dispatch/routing/route_set.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(raise_on_name_error) ⇒ Dispatcher

[ GitHub ]

  
# File 'actionpack/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 Attribute Details

#dispatcher?Boolean (readonly)

[ GitHub ]

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

def dispatcher?; true; end

Instance Method Details

#controller(req) (private)

[ GitHub ]

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

def controller(req)
  req.controller_class
rescue NameError => e
  raise ActionController::RoutingError, e.message, e.backtrace
end

#dispatch(controller, action, req, res) (private)

[ GitHub ]

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

def dispatch(controller, action, req, res)
  controller.dispatch(action, req, res)
end

#serve(req)

[ GitHub ]

  
# File 'actionpack/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