Sha256: 81098a6ccae3f49b203433a89ab552b397cd673ceb3bcfbb280b0c008a2b6bc6

Contents?: true

Size: 905 Bytes

Versions: 2

Compression:

Stored size: 905 Bytes

Contents

module Alba
  # This module represents the inflector, which is used by default
  module DefaultInflector
    begin
      require 'active_support/inflector'
    rescue LoadError
      raise ::Alba::Error, 'To use transform_keys, please install `ActiveSupport` gem.'
    end

    module_function

    # Camelizes a key
    #
    # @param key [String] key to be camelized
    # @return [String] camelized key
    def camelize(key)
      ActiveSupport::Inflector.camelize(key)
    end

    # Camelizes a key, 1st letter lowercase
    #
    # @param key [String] key to be camelized
    # @return [String] camelized key
    def camelize_lower(key)
      ActiveSupport::Inflector.camelize(key, false)
    end

    # Dasherizes a key
    #
    # @param key [String] key to be dasherized
    # @return [String] dasherized key
    def dasherize(key)
      ActiveSupport::Inflector.dasherize(key)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alba-1.5.0 lib/alba/default_inflector.rb
alba-1.4.0 lib/alba/default_inflector.rb