Module: Dry::Configurable::Methods

Included in:
ClassMethods, InstanceMethods
Defined in:
lib/dry/configurable/methods.rb

Overview

Common API for both classes and instances

Instance Method Summary collapse

Instance Method Details

#configure {|config| ... } ⇒ Object

Yields:

  • (config)

Raises:



10
11
12
13
14
15
# File 'lib/dry/configurable/methods.rb', line 10

def configure(&block)
  raise FrozenConfigError, "Cannot modify frozen config" if config.frozen?

  yield(config) if block
  self
end

#finalize!(freeze_values: false) ⇒ Dry::Configurable::Config

Finalize and freeze configuration



22
23
24
25
# File 'lib/dry/configurable/methods.rb', line 22

def finalize!(freeze_values: false)
  config.finalize!(freeze_values: freeze_values)
  self
end