Method: String#camelcase
- Defined in:
- lib/extra/string.rb
#camelcase(cap_first = false) ⇒ Object
Camelize string.
Example: 'what is my name'.camelcase #=> "whatIsMyName"
Returns: String
141 142 143 144 145 146 147 148 |
# File 'lib/extra/string.rb', line 141 def camelcase(cap_first = false) if size > 1 camelcased = capitalize_words.gsub(/[^a-z]/i, '') camelcased[0,1] = camelcased[0,1].downcase unless cap_first else self end end |