Sha256: 3d31394037354f46a3061a57063c26717f6ab8041c506919a7177a6d26fd2382

Contents?: true

Size: 879 Bytes

Versions: 3

Compression:

Stored size: 879 Bytes

Contents

# frozen_string_literal: true

module Dry
  module Core
    class Container
      # @api public
      module Configuration
        # Use dry/configurable if it's available
        begin
          require "dry/configurable"

          # @api private
          def self.extended(klass)
            super
            klass.class_eval do
              extend Dry::Configurable

              setting :namespace_separator, default: Config::DEFAULT_NAMESPACE_SEPARATOR
              setting :resolver, default: Config::DEFAULT_RESOLVER
              setting :registry, default: Config::DEFAULT_REGISTRY
            end
          end
        rescue LoadError
          # @api private
          def config
            @config ||= Container::Config.new
          end
        end

        # @api private
        def configure
          yield config
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-core-1.0.2 lib/dry/core/container/configuration.rb
dry-core-1.0.1 lib/dry/core/container/configuration.rb
dry-core-1.0.0 lib/dry/core/container/configuration.rb