aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-09-08 14:09:33 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-09-12 16:50:48 -0700
commit4ffe667ab7713a7cd926803655719b2a399615ce (patch)
tree4b2d87d2c0c553dc6eeb052d5a86bd0b211da784 /actionpack/lib
parent537ed6eb2f38f41da34bcecc51d2c25b961b53ef (diff)
downloadrails-4ffe667ab7713a7cd926803655719b2a399615ce.tar.gz
rails-4ffe667ab7713a7cd926803655719b2a399615ce.tar.bz2
rails-4ffe667ab7713a7cd926803655719b2a399615ce.zip
Instantiate each part of our routing system:
* A collection of Routes * The Router, which consults the collection of routes * A formatter that consults the collection of routes
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index ebefd0ecd4..3883ac7c60 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -206,7 +206,7 @@ module ActionDispatch
end
end
- attr_accessor :set, :routes, :named_routes, :default_scope
+ attr_accessor :formatter, :set, :routes, :named_routes, :default_scope, :router
attr_accessor :disable_clear_and_finalize, :resources_path_names
attr_accessor :default_url_options, :request_class, :valid_conditions
@@ -270,10 +270,11 @@ module ActionDispatch
@finalized = false
routes.clear
named_routes.clear
- @set = ::Rack::Mount::RouteSet.new(
+ @set = Journey::Routes.new
+ @router = Journey::Router.new(@set, {
:parameters_key => PARAMETERS_KEY,
- :request_class => request_class
- )
+ :request_class => request_class})
+ @formatter = Journey::Formatter.new @set
@prepend.each { |blk| eval_block(blk) }
end
@@ -448,7 +449,7 @@ module ActionDispatch
end
def generate
- path, params = @set.set.generate(:path_info, named_route, options, recall, PARAMETERIZE)
+ path, params = @set.formatter.generate(:path_info, named_route, options, recall, PARAMETERIZE)
raise_routing_error unless path
@@ -527,7 +528,7 @@ module ActionDispatch
def call(env)
finalize!
- @set.call(env)
+ @router.call(env)
end
def recognize_path(path, environment = {})
@@ -541,7 +542,7 @@ module ActionDispatch
end
req = @request_class.new(env)
- @set.recognize(req) do |route, matches, params|
+ @router.recognize(req) do |route, matches, params|
params.each do |key, value|
if value.is_a?(String)
value = value.dup.force_encoding(Encoding::BINARY) if value.encoding_aware?