diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-02-02 21:42:39 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-02-02 21:42:39 +0000 |
commit | c5d89bc9344f8a4cfbfe0d42b1b2d6378820bf85 (patch) | |
tree | 03e5449c0920ad474b3ade913657db43f505b75b /activesupport | |
parent | 5ef2b089f03271fcff02280fdcbb12d38d726eba (diff) | |
download | rails-c5d89bc9344f8a4cfbfe0d42b1b2d6378820bf85.tar.gz rails-c5d89bc9344f8a4cfbfe0d42b1b2d6378820bf85.tar.bz2 rails-c5d89bc9344f8a4cfbfe0d42b1b2d6378820bf85.zip |
Slight camelize speedup [Pratik Naik]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8788 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/inflector.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/inflector.rb b/activesupport/lib/active_support/inflector.rb index 8fca3e36da..9d3976da20 100644 --- a/activesupport/lib/active_support/inflector.rb +++ b/activesupport/lib/active_support/inflector.rb @@ -146,7 +146,7 @@ module Inflector # "active_record/errors".camelize(:lower) #=> "activeRecord::Errors" def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) if first_letter_in_uppercase - lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } + lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } else lower_case_and_underscored_word.first + camelize(lower_case_and_underscored_word)[1..-1] end |