Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/shot_libs/helper_loader.rb,
lib/shot_libs/library_loader.rb
Instance Method Summary collapse
-
#underscore ⇒ Object
Converts a CamelCased string to a underscore_string.
Instance Method Details
#underscore ⇒ Object
Converts a CamelCased string to a underscore_string
16 17 18 19 20 21 22 |
# File 'lib/shot_libs/helper_loader.rb', line 16 def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |