Module: ActiveSupport::Inflector
- Defined in:
- lib/duck_punches/inflector.rb
Class Method Summary collapse
Class Method Details
.camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/duck_punches/inflector.rb', line 4 def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) if first_letter_in_uppercase lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } else lower_case_and_underscored_word.first.downcase + camelize(lower_case_and_underscored_word)[1..-1] end end |