From ba7602b881b95666c3f076f8522d9eeaac8eeefb Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 12 Aug 2015 17:23:40 -0700 Subject: remove the `add_request_method` method I didn't like this method because it mutates the parameters. Now that the method is so small, just push it up to `initialize` --- actionpack/lib/action_dispatch/routing/mapper.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index bcc0e6fe9f..887b5957df 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -126,8 +126,9 @@ module ActionDispatch @conditions[:required_defaults] = (split_options[:required_defaults] || []).map(&:first) @conditions[:path_info] = path @conditions[:parsed_path_info] = ast - - add_request_method(via, @conditions) + unless via == [:all] + @conditions[:request_method] = via.map { |m| m.to_s.dasherize.upcase } + end end def to_route @@ -222,11 +223,6 @@ module ActionDispatch Hash[options.reject { |_, default| Regexp === default }] end - def add_request_method(via, conditions) - return if via == [:all] - conditions[:request_method] = via.map { |m| m.to_s.dasherize.upcase } - end - def app(blocks) if to.respond_to?(:call) Constraints.new(to, blocks, Constraints::CALL) -- cgit v1.2.3