Flowdock
method

camelize

Importance_2
v2.1.0 - Show latest stable - 1 note - Class: Inflector
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"
Show source
Register or log in to add new notes.
September 24, 2009 - (>= v2.2.1)
0 thanks