method
camelize

v6.0.0 -
Show latest stable
-
1 note -
Class: ActiveSupport::Inflector
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1 (0)
- 2.3.2 (0)
- 2.3.8 (0)
- 3.0.0 (38)
- 3.0.9 (-5)
- 3.1.0 (0)
- 3.2.1 (-2)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (-2)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (-7)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- What's this?
camelize(term, uppercase_first_letter = true)
public
Converts strings to UpperCamelCase. If the uppercase_first_letter parameter is set to false, then produces lowerCamelCase.
Also converts ‘/’ to ‘::’ which is useful for converting paths to namespaces.
camelize('active_model') # => "ActiveModel" camelize('active_model', false) # => "activeModel" camelize('active_model/errors') # => "ActiveModel::Errors" camelize('active_model/errors', false) # => "activeModel::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:
camelize(underscore('SSLError')) # => "SslError"
Register or
log in
to add new notes.
avakhov -
January 20, 2010

3 thanks
Reverse version of camelize
Reverse version of camelize is underscore