Sha256: 942a56a784d73a253342584588966ba91c176bcef1c46c3c5cfa55d834fa8a1f
Contents?: true
Size: 485 Bytes
Versions: 1
Compression:
Stored size: 485 Bytes
Contents
module Contentful # Utility methods used by the contentful gem module Support class << self # Transforms CamelCase into snake_case (taken from zucker) def snakify(object) object.to_s.gsub(/(?<!^)[A-Z]/) do "_#$&" end.downcase end # Transforms each hash key into a symbol (like in AS) def symbolize_keys(h) result = {} h.each_key{ |key| result[(key.to_sym rescue key)] = h[key] } result end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
contentful-0.1.0 | lib/contentful/support.rb |