From acf7642ecec5bdbe6efcb419434b04b35531a2b5 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Wed, 31 Jul 2019 12:06:06 +0900 Subject: Reduce some more Hash#fetch + default object allocations --- actionpack/lib/action_dispatch/routing/mapper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 42e770c5bf..da95e14cbb 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1887,7 +1887,7 @@ module ActionDispatch options_constraints = options.delete(:constraints) || {} path_types = paths.group_by(&:class) - path_types.fetch(String, []).each do |_path| + (path_types[String] || []).each do |_path| route_options = options.dup if _path && option_path raise ArgumentError, "Ambiguous route definition. Both :path and the route path were specified as strings." @@ -1896,7 +1896,7 @@ module ActionDispatch decomposed_match(_path, controller, route_options, _path, to, via, formatted, anchor, options_constraints) end - path_types.fetch(Symbol, []).each do |action| + (path_types[Symbol] || []).each do |action| route_options = options.dup decomposed_match(action, controller, route_options, option_path, to, via, formatted, anchor, options_constraints) end -- cgit v1.2.3