Module: AsyncStorage::Util::Strings
- Included in:
- Naming
- Defined in:
- lib/async_storage/util/strings.rb
Class Method Summary collapse
Class Method Details
.underscore(string, module_sep = '/') ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/async_storage/util/strings.rb', line 8 def underscore(string, module_sep = '/') string .gsub(/::/, module_sep) .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr('-', '_') .downcase end |