Sha256: 7029db9b01ce53fa59216e413b2c80c409b3505690c09f48b2043fba4ddb7f9a

Contents?: true

Size: 610 Bytes

Versions: 10

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

require 'dry/configurable/errors'

module Dry
  module Configurable
    # Common API for both classes and instances
    #
    # @api public
    module Methods
      # @api public
      def configure(&block)
        raise FrozenConfig, 'Cannot modify frozen config' if frozen?

        yield(config) if block
        self
      end

      # Finalize and freeze configuration
      #
      # @return [Dry::Configurable::Config]
      #
      # @api public
      def finalize!
        return self if config.frozen?

        config.finalize!
        self
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
dry-configurable-0.12.1 lib/dry/configurable/methods.rb
dry-configurable-0.12.0 lib/dry/configurable/methods.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/dry-configurable-0.11.6/lib/dry/configurable/methods.rb
dry-configurable-0.11.6 lib/dry/configurable/methods.rb
dry-configurable-0.11.5 lib/dry/configurable/methods.rb
dry-configurable-0.11.4 lib/dry/configurable/methods.rb
dry-configurable-0.11.3 lib/dry/configurable/methods.rb
dry-configurable-0.11.2 lib/dry/configurable/methods.rb
dry-configurable-0.11.1 lib/dry/configurable/methods.rb
dry-configurable-0.11.0 lib/dry/configurable/methods.rb