diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-09-22 11:50:15 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-09-22 18:08:03 -0300 |
commit | 59296ab26dc8518fb83f0015a3871936149b86da (patch) | |
tree | 521cb451877a1ea48f9fd97b50bf9a34e991201b /actionpack | |
parent | 8c97f49f2e63794514b563ba4078692c0be0c335 (diff) | |
download | rails-59296ab26dc8518fb83f0015a3871936149b86da.tar.gz rails-59296ab26dc8518fb83f0015a3871936149b86da.tar.bz2 rails-59296ab26dc8518fb83f0015a3871936149b86da.zip |
Refactor routing methods.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 7 |
2 files changed, 2 insertions, 11 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route.rb b/actionpack/lib/action_dispatch/routing/route.rb index aefebf8f80..f91a48e16c 100644 --- a/actionpack/lib/action_dispatch/routing/route.rb +++ b/actionpack/lib/action_dispatch/routing/route.rb @@ -21,11 +21,7 @@ module ActionDispatch conditions[:path_info] = ::Rack::Mount::Strexp.compile(path, requirements, SEPARATORS, anchor) end - @conditions = conditions.inject({}) { |h, (k, v)| - h[k] = Rack::Mount::RegexpWithNamedGroups.new(v) - h - } - + @conditions = Hash[conditions.map { |k,v| [k, Rack::Mount::RegexpWithNamedGroups.new(v)] }] @conditions.delete_if{ |k,v| k != :path_info && !valid_condition?(k) } @requirements.delete_if{ |k,v| !valid_condition?(k) } end diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 7ac07fe426..1a5f21bd09 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -566,13 +566,8 @@ module ActionDispatch keys = options.delete(:_positional_keys) keys -= options.keys if args.size < keys.size - 1 # take format into account - args = args.zip(keys).inject({}) do |h, (v, k)| - h[k] = v - h - end - # Tell url_for to skip default_url_options - options.merge!(args) + options.merge!(Hash[args.zip(keys).map { |v, k| [k, v] }]) end def rewrite_authentication(options) |