Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/finest/builder.rb
Overview
Add snake case in String
Instance Method Summary collapse
Instance Method Details
#snake_case ⇒ Object
7 8 9 |
# File 'lib/finest/builder.rb', line 7 def snake_case length > 7 ? strip.gsub(/(\w[A-Z]|\s\S)/) { |e| "#{e[0].strip}_#{e[1].strip.downcase}" }.downcase : strip.downcase end |