v0.15.0
Changed
-
The
finalize!
method (as class or instance method, depending on whether you extend or includeDry::Configurable
respectively) now accepts a booleanfreeze_values:
argument, which if true, will recursively freeze all config values in addition to theconfig
itself. (#105 by @ojab)class MyConfigurable include Dry::Configurable setting :db, default: "postgre" end my_obj = MyConfigurable.new my_obj.finalize!(freeze_values: true) my_obj.config.db << "sql" # Will raise FrozenError
-
Dry::Configurable::Config#update
will set hashes as values for non-nested settings (#131 by @ojab)class MyConfigurable extend Dry::Configurable setting :sslcert, constructor: ->(v) { v&.values_at(:pem, :pass)&.join } end MyConfigurable.config.update(sslcert: {pem: "cert", pass: "qwerty"}) MyConfigurable.config.sslcert # => "certqwerty"
-
Dry::Configurable::Config#update
will accept any values implicitly convertible to hash via#to_hash
(#133 by @timriley)