aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2013-07-10 17:41:41 +0900
committerAkira Matsuda <ronnie@dio.jp>2013-07-10 17:41:41 +0900
commitff8cbdd05b22fc7992c34eb12c7aa3da495555b8 (patch)
tree34033a4b02a1366e4db400e30490a56caf1c9c43 /activesupport/lib
parentcd0d5902dd237794049cac1ee89ab0c07a16a851 (diff)
downloadrails-ff8cbdd05b22fc7992c34eb12c7aa3da495555b8.tar.gz
rails-ff8cbdd05b22fc7992c34eb12c7aa3da495555b8.tar.bz2
rails-ff8cbdd05b22fc7992c34eb12c7aa3da495555b8.zip
Speedup AS::Inflector.camelize
Benchmark: user system total real old 5.960000 0.020000 5.980000 ( 5.981754) new 5.740000 0.030000 5.770000 ( 5.757201)
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/inflector/methods.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb
index 18c94a4997..8e546c0176 100644
--- a/activesupport/lib/active_support/inflector/methods.rb
+++ b/activesupport/lib/active_support/inflector/methods.rb
@@ -72,7 +72,9 @@ module ActiveSupport
else
string = string.sub(/^(?:#{inflections.acronym_regex}(?=\b|[A-Z_])|\w)/) { $&.downcase }
end
- string.gsub(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{inflections.acronyms[$2] || $2.capitalize}" }.gsub('/', '::')
+ string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{inflections.acronyms[$2] || $2.capitalize}" }
+ string.gsub!('/', '::')
+ string
end
# Makes an underscored, lowercase form from the expression in the string.