aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorPablo Herrero <pablodherrero@gmail.com>2014-11-01 20:16:03 -0300
committerPablo Herrero <pablodherrero@gmail.com>2014-11-01 20:23:29 -0300
commit861b70e92f4a1fc0e465ffcf2ee62680519c8f6f (patch)
treecc5ce3c824b091cc88fb2c9c1f8557905108f265 /activesupport
parentdaab7e59a6196fa2bbab17dc4a88b095a211fc96 (diff)
downloadrails-861b70e92f4a1fc0e465ffcf2ee62680519c8f6f.tar.gz
rails-861b70e92f4a1fc0e465ffcf2ee62680519c8f6f.tar.bz2
rails-861b70e92f4a1fc0e465ffcf2ee62680519c8f6f.zip
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.rb2
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