Use merge! in some places to avoid creating extra hashes

This commit is contained in:
Carlos Antonio da Silva 2012-11-23 20:40:21 -02:00
parent 2b64e9b1bd
commit d98014cbcb
2 changed files with 4 additions and 4 deletions

@ -152,7 +152,7 @@ def app
end
def conditions
{ :path_info => @path }.merge(constraints).merge(request_method_condition)
{ :path_info => @path }.merge!(constraints).merge!(request_method_condition)
end
def requirements
@ -285,7 +285,7 @@ module Base
# of most Rails applications, this is beneficial.
def root(options = {})
options = { :to => options } if options.is_a?(String)
match '/', { :as => :root, :via => :get }.merge(options)
match '/', { :as => :root, :via => :get }.merge!(options)
end
# Matches a url pattern to one or more routes. Any symbols in a pattern
@ -845,7 +845,7 @@ def merge_blocks_scope(parent, child) #:nodoc:
end
def merge_options_scope(parent, child) #:nodoc:
(parent || {}).except(*override_keys(child)).merge(child)
(parent || {}).except(*override_keys(child)).merge!(child)
end
def merge_shallow_scope(parent, child) #:nodoc:

@ -75,7 +75,7 @@ def path(params, request)
:port => request.optional_port,
:path => request.path,
:params => request.query_parameters
}.merge options
}.merge! options
if !params.empty? && url_options[:path].match(/%\{\w*\}/)
url_options[:path] = (url_options[:path] % escape_path(params))