def snake_case(s)
      if s.match(/\A[A-Z]+\z/)
        s.downcase
      else
        s.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
         gsub(/([a-z])([A-Z])/, '\1_\2').
         downcase
      end
    end
def snake_case(s)
      if s.match(/\A[A-Z]+\z/)
        s.downcase
      else
        s.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
         gsub(/([a-z])([A-Z])/, '\1_\2').
         downcase
      end
    end
Convert to snake case.

   "FooBar".snake_case           #=> "foo_bar"
   "HeadlineCNNNews".snake_case  #=> "headline_cnn_news"
   "CNN".snake_case              #=> "cnn"

 @return [String] Receiver converted to snake case.

 @api public
 borrowed from https://github.com/datamapper/extlib/blob/master/lib/extlib/string.rb