Module: WowzaRest::CoreExt::String::Inflections
- Defined in:
- lib/wowza_rest/core_ext/string/inflections.rb
Instance Method Summary collapse
Instance Method Details
#camelize ⇒ Object
13 14 15 16 17 18 |
# File 'lib/wowza_rest/core_ext/string/inflections.rb', line 13 def camelize tr('-', '_') .gsub(/\b[A-Z]+/, &:downcase) .gsub(/_(.)/, &:upcase) .tr('_', '') end |
#underscore ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/wowza_rest/core_ext/string/inflections.rb', line 5 def underscore gsub(/::/, '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr('-', '_') .downcase end |