Method: String#to_snake
- Defined in:
- lib/wavefront-cli/stdlib/string.rb
#to_snake ⇒ String
Make a camelCase string be snake_case
95 96 97 98 99 |
# File 'lib/wavefront-cli/stdlib/string.rb', line 95 def to_snake gsub(/(.)([A-Z])/) do "#{Regexp.last_match[1]}_#{Regexp.last_match[2].downcase}" end end |