From 00adce4ff0b44865a7b3b7cec391220487e88565 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Fri, 15 Nov 2013 01:20:18 -0200 Subject: Avoid hash lookups for building an array of required defaults Only set the value once after it's calculated. --- actionpack/lib/action_dispatch/routing/mapper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 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 a537ed09b8..3d3299afb3 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -176,12 +176,13 @@ module ActionDispatch end end - @conditions[:required_defaults] = [] + required_defaults = [] options.each do |key, required_default| unless segment_keys.include?(key) || IGNORE_OPTIONS.include?(key) || Regexp === required_default - @conditions[:required_defaults] << key + required_defaults << key end end + @conditions[:required_defaults] = required_defaults via_all = options.delete(:via) if options[:via] == :all -- cgit v1.2.3