From fd924371126a50789d31582b9efa074fd47a803e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 30 Apr 2014 10:56:48 -0700 Subject: split nil / Hash cases in url_for this reduces the number of comparisons and method calls `url_for` requires. The nil case no longer calls `symbolize_keys`, we already know options is nil, so no more ||=, and since it is nil we already know that options[:host] will be nil too. --- actionview/lib/action_view/routing_url_for.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/routing_url_for.rb b/actionview/lib/action_view/routing_url_for.rb index 33be06cbf7..b9e4b590e7 100644 --- a/actionview/lib/action_view/routing_url_for.rb +++ b/actionview/lib/action_view/routing_url_for.rb @@ -77,10 +77,10 @@ module ActionView case options when String options - when nil, Hash - options ||= {} - options = { :only_path => options[:host].nil? }.merge!(options.symbolize_keys) - super + when nil + super({:only_path => true}) + when Hash + super({ :only_path => options[:host].nil? }.merge!(options.symbolize_keys)) when :back _back_url when Array -- cgit v1.2.3