aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/journey
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-07-02 01:07:08 +0930
committerMatthew Draper <matthew@trebex.net>2017-07-02 01:07:12 +0930
commitafb66a5a598ce4ac74ad84b125a5abf046dcf5aa (patch)
tree33d690f194f243a3fb63e69f8393ff46cc396249 /actionpack/lib/action_dispatch/journey
parent9ecdcac16795854bd02f1addcf75b84d34bbdf86 (diff)
parent3d453b409d037a056d0bcd636a2e020cc7cef4a8 (diff)
downloadrails-afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.tar.gz
rails-afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.tar.bz2
rails-afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.zip
Merge pull request #29506 from pat/frozen-string-literals
Make ActiveSupport frozen-string-literal friendly.
Diffstat (limited to 'actionpack/lib/action_dispatch/journey')
-rw-r--r--actionpack/lib/action_dispatch/journey/router/utils.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/journey/router/utils.rb b/actionpack/lib/action_dispatch/journey/router/utils.rb
index 6d400f3364..1ac86d10d6 100644
--- a/actionpack/lib/action_dispatch/journey/router/utils.rb
+++ b/actionpack/lib/action_dispatch/journey/router/utils.rb
@@ -14,11 +14,11 @@ module ActionDispatch
# normalize_path("/%ab") # => "/%AB"
def self.normalize_path(path)
encoding = path.encoding
- path = "/#{path}"
+ path = "/#{path}".dup
path.squeeze!("/".freeze)
path.sub!(%r{/+\Z}, "".freeze)
path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase }
- path = "/" if path == "".freeze
+ path = "/".dup if path == "".freeze
path.force_encoding(encoding)
path
end
@@ -29,7 +29,7 @@ module ActionDispatch
ENCODE = "%%%02X".freeze
US_ASCII = Encoding::US_ASCII
UTF_8 = Encoding::UTF_8
- EMPTY = "".force_encoding(US_ASCII).freeze
+ EMPTY = "".dup.force_encoding(US_ASCII).freeze
DEC2HEX = (0..255).to_a.map { |i| ENCODE % i }.map { |s| s.force_encoding(US_ASCII) }
ALPHA = "a-zA-Z".freeze