Class: ActionController::Routing::RouteSet::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/mount/mappers/rails_classic.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Dispatcher

Returns a new instance of Dispatcher.



11
12
13
14
15
# File 'lib/rack/mount/mappers/rails_classic.rb', line 11

def initialize(options = {})
  defaults = options[:defaults]
  @glob_param = options.delete(:glob)
  @app = controller(defaults) if bind_controller_const?
end

Instance Method Details

#call(env) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/rack/mount/mappers/rails_classic.rb', line 17

def call(env)
  params = env[::Rack::Mount::Const::RACK_ROUTING_ARGS]
  app = @app || controller(params)
  merge_default_action!(params)
  split_glob_param!(params) if @glob_param

  # TODO: Rails response is not finalized by the controller
  app.call(env).to_a
end