Sha256: 2317d07207223d580d62a8a58a14aa024a33e1b79ca587afdcebc0f248c5262c

Contents?: true

Size: 408 Bytes

Versions: 5

Compression:

Stored size: 408 Bytes

Contents

module Contentful
  # Utility methods used by the contentful gem
  module Support
    class << self
      # Transforms CamelCase into snake_case (taken from zucker)
      #
      # @param [String] object camelCaseName
      #
      # @return [String] snake_case_name
      def snakify(object)
        snake = String(object).gsub(/(?<!^)[A-Z]/) { "_#{$&}" }
        snake.downcase
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
contentful-1.0.0 lib/contentful/support.rb
contentful-0.12.0 lib/contentful/support.rb
contentful-0.11.0 lib/contentful/support.rb
contentful-0.10.0 lib/contentful/support.rb
contentful-0.9.0 lib/contentful/support.rb