method
camelize
![Moderate documentation Importance_2](https://d2vfyqvduarcvs.cloudfront.net/images/importance_2.png?1349367920)
camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
public
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.
Examples:
"active_record".camelize # => "ActiveRecord" "active_record".camelize(:lower) # => "activeRecord" "active_record/errors".camelize # => "ActiveRecord::Errors" "active_record/errors".camelize(:lower) # => "activeRecord::Errors"
As a rule of thumb you can think of camelize as the inverse of underscore, though there are cases where that does not hold:
"SSLError".underscore.camelize # => "SslError"
Register or
log in
to add new notes.
avakhov -
January 20, 2010
![Default_avatar_30](https://www.gravatar.com/avatar/54e74983d81fa2fbe4c28e8392532f18?size=30&default=http://apidock.com/images/default_avatar_30.png)
3 thanks
Reverse version of camelize
Reverse version of camelize is underscore