module Ekispert::Util
Public Instance Methods
snakecase(str)
click to toggle source
Ex. snakecase('GeoPoint') #=> 'geo_point'
# File lib/ekispert/util.rb, line 4 def snakecase(str) str = str.to_s return str unless /[A-Z-]/.match?(str) str.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase end