diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-20 03:32:28 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-20 03:32:28 +0000 |
commit | 4e7c6f58fb14ad8783062303191eebed7699965b (patch) | |
tree | c88321c7d094d0419f4e7fb7b418b65b7e1fec64 /activesupport/lib/active_support/core_ext/string/inflections.rb | |
parent | f49ba114dbb330c1865682c111a9ba372cb40bda (diff) | |
download | rails-4e7c6f58fb14ad8783062303191eebed7699965b.tar.gz rails-4e7c6f58fb14ad8783062303191eebed7699965b.tar.bz2 rails-4e7c6f58fb14ad8783062303191eebed7699965b.zip |
Added option to String#camelize to generate lower-cased camel case by passing in :lower, like "super_man".camelize(:lower) # => "superMan" [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3986 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/string/inflections.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/inflections.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb index eef8a5bc89..07291032a6 100644 --- a/activesupport/lib/active_support/core_ext/string/inflections.rb +++ b/activesupport/lib/active_support/core_ext/string/inflections.rb @@ -12,8 +12,11 @@ module ActiveSupport #:nodoc: Inflector.singularize(self) end - def camelize - Inflector.camelize(self) + def camelize(first_letter = :upper) + case first_letter + when :upper then Inflector.camelize(self, true) + when :lower then Inflector.camelize(self, false) + end end alias_method :camelcase, :camelize |