Sha256: 36050de5b5eba637bd0342c974db40b58fefd57b7d590e72221e205cfe4da058

Contents?: true

Size: 808 Bytes

Versions: 16

Compression:

Stored size: 808 Bytes

Contents

# frozen_string_literal: true

# @api private
# @since 0.2.0
module Qonfig::Loaders
  require_relative 'loaders/basic'
  require_relative 'loaders/json'
  require_relative 'loaders/yaml'
  require_relative 'loaders/dynamic'
  require_relative 'loaders/end_data'

  class << self
    # @param format [String, Symbol]
    # @return [Module]
    #
    # @raise [Qonfig::UnsupportedLoaderFormatError]
    #
    # @api private
    # @since 0.15.0
    def resolve(format)
      case format.to_s
      when 'yaml', 'yml'
        Qonfig::Loaders::YAML
      when 'json'
        Qonfig::Loaders::JSON
      when 'dynamic'
        Qonfig::Loaders::Dynamic
      else
        raise(Qonfig::UnsupportedLoaderFormatError, "<#{format}> format is not supported.")
      end
    end
    alias_method :[], :resolve
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
qonfig-0.30.0 lib/qonfig/loaders.rb
qonfig-0.28.0 lib/qonfig/loaders.rb
qonfig-0.27.0 lib/qonfig/loaders.rb
qonfig-0.26.0 lib/qonfig/loaders.rb
qonfig-0.25.0 lib/qonfig/loaders.rb
qonfig-0.24.1 lib/qonfig/loaders.rb
qonfig-0.24.0 lib/qonfig/loaders.rb
qonfig-0.23.0 lib/qonfig/loaders.rb
qonfig-0.22.0 lib/qonfig/loaders.rb
qonfig-0.21.0 lib/qonfig/loaders.rb
qonfig-0.20.0 lib/qonfig/loaders.rb
qonfig-0.19.1 lib/qonfig/loaders.rb
qonfig-0.19.0 lib/qonfig/loaders.rb
qonfig-0.18.1 lib/qonfig/loaders.rb
qonfig-0.18.0 lib/qonfig/loaders.rb
qonfig-0.17.0 lib/qonfig/loaders.rb