Module: Contentful::Support
- Defined in:
- lib/contentful/support.rb
Overview
Utility methods used by the contentful gem
Class Method Summary (collapse)
-
+ (String) snakify(object)
Transforms CamelCase into snake_case (taken from zucker).
Class Method Details
+ (String) snakify(object)
Transforms CamelCase into snake_case (taken from zucker)
10 11 12 13 |
# File 'lib/contentful/support.rb', line 10 def snakify(object) snake = String(object).gsub(/(?<!^)[A-Z]/) { "_#{$&}" } snake.downcase end |