Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/core_ext/string/underscore.rb
Instance Method Summary collapse
Instance Method Details
#underscore ⇒ Object
2 3 4 5 |
# File 'lib/core_ext/string/underscore.rb', line 2 def underscore str = to_s str[0, 1].downcase + str[1..-1].gsub(/[A-Z]/) { |c| "_#{c.downcase}" } end |