Skip to content
Browse files

Slight camelize speedup [Pratik Naik]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8788 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 5ef2b08 commit c5d89bc9344f8a4cfbfe0d42b1b2d6378820bf85 @jeremy jeremy committed Feb 2, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/inflector.rb
View
2 activesupport/lib/active_support/inflector.rb
@@ -146,7 +146,7 @@ def singularize(word)
# "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

0 comments on commit c5d89bc

Please sign in to comment.
Something went wrong with that request. Please try again.