Module: Contentful::Support

Defined in:
lib/contentful/support.rb

Overview

Utility methods used by the contentful gem

Class Method Summary collapse

Class Method Details

.snakify(object) ⇒ Object

Transforms CamelCase into snake_case (taken from zucker)



6
7
8
9
# File 'lib/contentful/support.rb', line 6

def snakify(object)
  snake = String(object).gsub(/(?<!^)[A-Z]/) { "_#$&" }
  snake.downcase
end