1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Refactor routing methods.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
This commit is contained in:
Emilio Tagua 2010-09-22 11:50:15 -03:00 committed by Santiago Pastorino
parent 8c97f49f2e
commit 59296ab26d
2 changed files with 2 additions and 11 deletions

View file

@ -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

View file

@ -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)