module Helpers

Public Class Methods

to_snake_case(str) click to toggle source
# File lib/capital-bikeshare/helpers.rb, line 2
def self.to_snake_case(str)
  str.gsub(/::/, '/').
  gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
  gsub(/([a-z\d])([A-Z])/,'\1_\2').
  tr("-", "_").
  downcase
end