diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-12 17:10:44 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-12 17:10:44 -0700 |
commit | a4f780947299cc35f14c9e1825278155ae88ee44 (patch) | |
tree | 90b24a4c549d43fbdea2ff5e0b66d069f0d02146 /actionpack/lib | |
parent | 3e3e23f0484b4891a70eecd89f30b8ad81852e8b (diff) | |
download | rails-a4f780947299cc35f14c9e1825278155ae88ee44.tar.gz rails-a4f780947299cc35f14c9e1825278155ae88ee44.tar.bz2 rails-a4f780947299cc35f14c9e1825278155ae88ee44.zip |
remove side effects in `normalize_defaults`
now the `@defaults` variable doesn't need to be set before calling
`normalize_defaults`
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index f4f34e7924..bcc0e6fe9f 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -121,14 +121,13 @@ module ActionDispatch @requirements = formats[:requirements].merge Hash[requirements] @conditions = Hash[conditions] - @defaults = formats[:defaults].merge @defaults + @defaults = formats[:defaults].merge(@defaults).merge(normalize_defaults(options)) @conditions[:required_defaults] = (split_options[:required_defaults] || []).map(&:first) @conditions[:path_info] = path @conditions[:parsed_path_info] = ast add_request_method(via, @conditions) - normalize_defaults!(options) end def to_route @@ -219,12 +218,8 @@ module ActionDispatch end end - def normalize_defaults!(options) - options.each_pair do |key, default| - unless Regexp === default - @defaults[key] = default - end - end + def normalize_defaults(options) + Hash[options.reject { |_, default| Regexp === default }] end def add_request_method(via, conditions) |