diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-06-01 23:17:42 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-06-01 23:17:42 -0300 |
commit | c87cce1ddfe2a68dd598bece49769f3f72322a28 (patch) | |
tree | b57ed85c9479a1e3ec298dab40f2109a79bc1194 | |
parent | f40ccb54648717dea70ebfc96e2e438f93321ffa (diff) | |
parent | e1a7260640295642108a364c2cfa56b6868d9947 (diff) | |
download | rails-c87cce1ddfe2a68dd598bece49769f3f72322a28.tar.gz rails-c87cce1ddfe2a68dd598bece49769f3f72322a28.tar.bz2 rails-c87cce1ddfe2a68dd598bece49769f3f72322a28.zip |
Merge pull request #20410 from schneems/schneems/boo-global-vars
Use block variable instead of global
-rw-r--r-- | actionpack/lib/action_dispatch/journey/router/utils.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/inflector/methods.rb | 4 | ||||
-rwxr-xr-x | tools/profile | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/journey/router/utils.rb b/actionpack/lib/action_dispatch/journey/router/utils.rb index 2b0a6575d4..d02ed96d0d 100644 --- a/actionpack/lib/action_dispatch/journey/router/utils.rb +++ b/actionpack/lib/action_dispatch/journey/router/utils.rb @@ -55,7 +55,7 @@ module ActionDispatch def unescape_uri(uri) encoding = uri.encoding == US_ASCII ? UTF_8 : uri.encoding - uri.gsub(ESCAPED) { [$&[1, 2].hex].pack('C') }.force_encoding(encoding) + uri.gsub(ESCAPED) { |match| [match[1, 2].hex].pack('C') }.force_encoding(encoding) end protected diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index bde70d772d..49fd1723e2 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -68,9 +68,9 @@ module ActiveSupport def camelize(term, uppercase_first_letter = true) string = term.to_s if uppercase_first_letter - string = string.sub(/^[a-z\d]*/) { inflections.acronyms[$&] || $&.capitalize } + string = string.sub(/^[a-z\d]*/) { |match| inflections.acronyms[match] || match.capitalize } else - string = string.sub(/^(?:#{inflections.acronym_regex}(?=\b|[A-Z_])|\w)/) { $&.downcase } + string = string.sub(/^(?:#{inflections.acronym_regex}(?=\b|[A-Z_])|\w)/) { |match| match.downcase } end string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{inflections.acronyms[$2] || $2.capitalize}" } string.gsub!('/'.freeze, '::'.freeze) diff --git a/tools/profile b/tools/profile index eb7fc7792b..191e73b3dd 100755 --- a/tools/profile +++ b/tools/profile @@ -117,9 +117,9 @@ rescue LoadError def camelize(uppercase_first_letter = true) string = self if uppercase_first_letter - string = string.sub(/^[a-z\d]*/) { $&.capitalize } + string = string.sub(/^[a-z\d]*/) { |match| match.capitalize } else - string = string.sub(/^(?:(?=\b|[A-Z_])|\w)/) { $&.downcase } + string = string.sub(/^(?:(?=\b|[A-Z_])|\w)/) { |match| match.downcase } end string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub('/', '::') end |