instance method
camelize
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
camelize(first_letter = :upper)
By default, camelize converts strings to UpperCamelCase. If the argument to camelize is set to :lower then camelize produces lowerCamelCase.
camelize will also convert ‘/’ to ‘::’ which is useful for converting paths to namespaces.
"active_record".camelize # => "ActiveRecord" "active_record".camelize(:lower) # => "activeRecord" "active_record/errors".camelize # => "ActiveRecord::Errors" "active_record/errors".camelize(:lower) # => "activeRecord::Errors"
Parameters
-
first_letteropt = :upper
Source
# File activesupport/lib/active_support/core_ext/string/inflections.rb, line 44
def camelize(first_letter = :upper)
case first_letter
when :upper then Inflector.camelize(self, true)
when :lower then Inflector.camelize(self, false)
end
end
Defined in activesupport/lib/active_support/core_ext/string/inflections.rb line 44
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::CoreExtensions::String::Inflections