diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2014-11-01 18:48:23 -0600 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2014-11-01 18:48:23 -0600 |
commit | 8b611b705b668d98ad2b7cf166f7e99cffca6ba3 (patch) | |
tree | ed05724bb101dfebb48d138ee58f77777641173c /activesupport | |
parent | 50e7c013c04544091f0081e495cacdd987f4d8e1 (diff) | |
parent | 861b70e92f4a1fc0e465ffcf2ee62680519c8f6f (diff) | |
download | rails-8b611b705b668d98ad2b7cf166f7e99cffca6ba3.tar.gz rails-8b611b705b668d98ad2b7cf166f7e99cffca6ba3.tar.bz2 rails-8b611b705b668d98ad2b7cf166f7e99cffca6ba3.zip |
Merge pull request #17483 from pabloh/optimize_gsub_calls
Call gsub with a Regexp instead of a String for better performance
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/inflector/methods.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index 637736c5df..74b3a7c2a9 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -73,7 +73,7 @@ module ActiveSupport string = string.sub(/^(?:#{inflections.acronym_regex}(?=\b|[A-Z_])|\w)/) { $&.downcase } end string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{inflections.acronyms[$2] || $2.capitalize}" } - string.gsub!('/', '::') + string.gsub!(/\//, '::') string end |