aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-06-01 23:17:42 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-06-01 23:17:42 -0300
commitc87cce1ddfe2a68dd598bece49769f3f72322a28 (patch)
treeb57ed85c9479a1e3ec298dab40f2109a79bc1194 /activesupport
parentf40ccb54648717dea70ebfc96e2e438f93321ffa (diff)
parente1a7260640295642108a364c2cfa56b6868d9947 (diff)
downloadrails-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
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/inflector/methods.rb4
1 files changed, 2 insertions, 2 deletions
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)