2020-01-17 09:24:49 +00:00
---
2022-11-04 12:55:12 +00:00
- version : 1.0 .0
date : 2022-11-04
changed :
- "Dependency on `dry-core` was updated to ~> 1.0 (@solnic)"
2022-10-13 08:21:29 +00:00
- version : 0.16 .1
2022-10-12 19:42:21 +00:00
date : 2022-10-13
changed :
- |-
Restored performance of config value reads (direct reader methods as well as aggregate methods like `#values` and `#to_h`) to pre-0.16.0 levels (#149 by @timriley)
2022-10-07 23:04:31 +00:00
- version : 0.16 .0
summary :
date : 2022-10-08
2022-09-13 17:43:20 +00:00
fixed :
2022-10-07 23:04:31 +00:00
- 'Remove exec bit from version.rb (#139 by @Fryguy)'
2022-09-13 17:41:17 +00:00
added :
2022-10-07 23:04:31 +00:00
- |-
Support for custom config classes via `config_class:` option (#136 by @solnic)
2022-10-07 23:06:27 +00:00
```ruby
extend Dry::Configurable(config_class : MyConfig)
```
2022-10-07 23:04:31 +00:00
2022-10-07 23:06:27 +00:00
Your config class should inherit from `Dry::Configurable::Config`.
2022-10-07 23:04:31 +00:00
- |-
Return `Dry::Core::Constants::Undefined` (instead of nil) as the value for non-configured settings via a `default_undefined : true ` option (#141 by @timriley)
2022-10-07 23:06:27 +00:00
```ruby
extend Dry::Configurable(default_undefined : true )
```
2022-10-07 23:04:31 +00:00
2022-10-07 23:06:27 +00:00
You must opt into this feature via the `default_undefined : true ` option. Non-configured setting values are still `nil` by default.
2022-07-04 05:46:59 +00:00
changed :
2022-10-07 23:04:31 +00:00
- |-
Improve memory usage by separating setting definitions from config values (#138 by @timriley)
2022-10-07 23:06:27 +00:00
Your usage of dry-configurable may be impacted if you have been accessing objects from `_settings` or the internals of `Dry::Configurable::Config`. `_settings` now returns `Dry::Configurable::Setting` instances, which contain only the details from the setting's definition. Setting _values_ remain in `Dry::Configurable::Config`.
2022-10-07 23:04:31 +00:00
- |-
Use Zeitwerk to speed up load time (#135 by @solnic)
2022-04-21 07:08:56 +00:00
- version : 0.15 .0
2022-10-07 23:04:31 +00:00
summary :
2022-04-21 07:08:56 +00:00
date : '2022-04-21'
changed :
2022-07-04 05:46:59 +00:00
- |-
The `finalize!` method (as class or instance method, depending on whether you extend or include `Dry::Configurable` respectively) now accepts a boolean `freeze_values:` argument, which if true, will recursively freeze all config values in addition to the `config` itself. (#105 by @ojab)
2022-04-21 07:08:56 +00:00
2022-07-04 05:46:59 +00:00
```ruby
class MyConfigurable
include Dry::Configurable
2022-04-21 07:08:56 +00:00
2022-07-04 05:46:59 +00:00
setting :db, default : "postgre"
end
2022-04-21 07:08:56 +00:00
2022-07-04 05:46:59 +00:00
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)
2022-04-21 07:08:56 +00:00
2022-07-04 05:46:59 +00:00
```ruby
class MyConfigurable
extend Dry::Configurable
2022-04-21 07:08:56 +00:00
2022-07-04 05:46:59 +00:00
setting :sslcert, constructor : ->(v) { v&.values_at(:pem, :pass)&.join }
end
2022-04-21 07:08:56 +00:00
2022-07-04 05:46:59 +00:00
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)"
2022-01-14 00:10:45 +00:00
- version : 0.14 .0
2022-10-07 23:04:31 +00:00
summary :
2022-01-14 00:10:45 +00:00
date : '2022-01-14'
changed :
2022-07-04 05:46:59 +00:00
- Settings defined after an access to `config` will still be made available on that
`config`. (#130 by @timriley)
- Cloneable settings are cloned immediately upon assignment. (#130 by @timriley)
- Changes to config values in parent classes after subclasses have already been
created will not be propogated to those subclasses. Subclasses created _after_
config values have been changed in the parent _will_ receive those config values.
(#130 by @timriley)
2021-09-12 11:47:39 +00:00
- version : 0.13 .0
2022-10-07 23:04:31 +00:00
summary :
2021-09-12 11:47:39 +00:00
date : '2021-09-12'
2021-06-28 15:55:32 +00:00
fixed :
2022-07-04 05:46:59 +00:00
- Fixed `ArgumentError` for classes including `Dry::Configurable` whose `initializer`
has required kwargs. (#113 by @timriley)
2021-06-28 15:55:32 +00:00
added :
2022-07-04 05:46:59 +00:00
- |-
Added flags to determine whether to warn on the API usage deprecated in this release (see "Changed" section below). Set these to `false` to suppress the warnings. (#124 by @timriley)
2021-09-12 11:47:39 +00:00
2022-07-04 05:46:59 +00:00
```ruby
Dry::Configurable.warn_on_setting_constructor_block false
Dry::Configurable.warn_on_setting_positional_default false
```
2021-06-28 15:55:32 +00:00
changed :
2022-07-04 05:46:59 +00:00
- |-
Deprecated the setting constructor provided as a block. Provide it via the `constructor:` keyword argument instead. (#111 by @waiting-for-dev & @timriley)
2021-09-12 11:47:39 +00:00
2022-07-04 05:46:59 +00:00
```ruby
setting :path, constructor : -> path { Pathname(path) }
```
- |-
Deprecated the setting default provided as the second positional argument. Provide it via the `default:` keyword argument instead. (#112 and #121 by @waiting-for-dev & @timriley)
2021-09-12 11:47:39 +00:00
2022-07-04 05:46:59 +00:00
```ruby
setting :path, default : "some/default/path"
```
- "[BREAKING] Removed implicit `to_hash` conversion from `Config`. (#114 by @timriley)"
2021-02-15 10:04:28 +00:00
- version : 0.12 .1
2022-10-07 23:04:31 +00:00
summary :
2021-02-15 10:04:28 +00:00
date : '2021-02-15'
fixed :
- |-
Only `#initialize` instance method is prepended, leaving the rest of the instance
methods to be included as normal again. This allows classes including
`Dry::Configurable` to override instance methods with their own methods as required
(@adam12 in #103)
2021-01-12 11:26:26 +00:00
added :
- |-
Settings may be specified with a `cloneable` option, e.g.
```ruby
setting :component_dirs, Configuration::ComponentDirs.new, cloneable : true
```
This change makes it possible to provide “rich” config values that carry their own
configuration interface.
In the above example, `ComponentDirs` could provide its own API for adding component
dirs and configuring aspects of their behavior at the same time. By being passed to
the setting along with `cloneable : true `, dry-configurable will ensure the setting's
values are cloned along with the setting at all the appropriate times.
A custom cloneable setting value should provide its own `#initialize_copy` (used by
`Object#dup`) with the appropriate logic. (@timriley in #102)
2020-12-26 16:30:16 +00:00
- version : 0.12 .0
2022-10-07 23:04:31 +00:00
summary :
2020-12-26 16:30:16 +00:00
date : '2020-12-26'
2020-09-16 12:55:39 +00:00
fixed :
2022-07-04 05:46:59 +00:00
- Setting values provided by defaults and/or pre-processor blocks are no longer
accidentally memoized across instances of classes including Dry::Configurable
(#99) (@timriley & @esparta)
2022-10-07 23:04:31 +00:00
added :
2020-08-05 09:28:22 +00:00
changed :
- 'Instance behavior is now prepended, so that if you have your own `initialize`,
calling `super` is no longer required (see #98 for more details) (@zabolotnov87)'
2022-07-04 05:46:59 +00:00
- Switched to equalizer from dry-core (@solnic)
2020-06-22 12:49:10 +00:00
- version : 0.11 .6
2022-10-07 23:04:31 +00:00
summary :
2020-06-22 12:49:10 +00:00
date : '2020-06-22'
2022-10-07 23:04:31 +00:00
fixed :
added :
2020-06-22 12:35:50 +00:00
changed :
2020-04-18 08:49:05 +00:00
- 'A meaningful error is raised when the extension is included more than once (issue
#89 fixed via #94) (@landongrindheim)'
2020-06-22 12:30:00 +00:00
- Evaluate setting input immediately when input is provided. This allows for earlier
feedback from constructors designed to raise errors on invalid input (#95) (@timriley)
2020-03-23 09:42:36 +00:00
- version : 0.11 .5
2022-10-07 23:04:31 +00:00
summary :
2020-03-23 09:42:36 +00:00
date : '2020-03-23'
fixed :
- 'When settings are copied or cloned, unevaluated values will no longer be copied.
This prevents unintended crashes when settings have constructors expecting a certain
type of value, but that value is yet to be provided (Fixed via #87) (@timriley)'
2022-10-07 23:04:31 +00:00
added :
2020-04-18 08:47:58 +00:00
changed :
- 'A meaningful error is raised when the extension is included more than once (issue
#89 fixed via #94) (@landongrindheim)'
2020-03-16 10:45:53 +00:00
- version : 0.11 .4
2022-10-07 23:04:31 +00:00
summary :
2020-03-16 10:45:53 +00:00
date : '2020-03-16'
fixed :
2020-03-23 09:42:36 +00:00
- "`Config#update` returns `self` again (issue #60 fixed via #92) (@solnic)"
2020-03-16 10:50:48 +00:00
changed :
2020-03-23 09:42:36 +00:00
- "`Setting#inspect` no longer uses its value - this could cause crashes when inspecting
settings that are yet to have a value applied (e.g. when they have a constructor
that expects a value to be present) (@timriley)"
2020-02-22 11:50:41 +00:00
- version : 0.11 .3
2022-10-07 23:04:31 +00:00
summary :
2020-02-22 22:40:50 +00:00
date : '2020-02-22'
2020-02-22 11:50:41 +00:00
fixed :
- 'Retrieving settings by a string name works again (issue #82) (@waiting-for-dev)'
2022-10-07 23:04:31 +00:00
added :
changed :
2020-02-20 18:00:14 +00:00
- version : 0.11 .2
2022-10-07 23:04:31 +00:00
summary :
2020-02-20 18:00:14 +00:00
date : '2020-02-20'
fixed :
2020-02-22 11:50:41 +00:00
- Warning about redefined `Setting#value` is gone (@solnic)
2020-02-18 15:16:18 +00:00
- version : 0.11 .1
2022-10-07 23:04:31 +00:00
summary :
2020-02-18 15:16:18 +00:00
date : '2020-02-18'
2020-02-18 15:13:43 +00:00
fixed :
- 'You can use `:settings` as a config key again (issue #80) (@solnic)'
2020-02-18 15:15:25 +00:00
- Setting value is lazy-evaluated now, which fixes some cases where a constructor
could crash with a `nil` value (@solnic)
2022-10-07 23:04:31 +00:00
added :
changed :
2020-02-15 13:50:47 +00:00
- version : 0.11 .0
date : '2020-02-15'
2020-02-18 15:13:43 +00:00
summary : 'Complete rewrite of the library while keeping the public API intact. See
#78 for a detailed overview.'
2020-02-15 13:16:40 +00:00
changed :
2020-02-18 15:13:43 +00:00
- Accessing config in a parent class no longer prevents you from adding more settings
in a child class (@solnic)
- "(internal) New low-level Setting and Config API (@solnic)"
- "(internal) `config` objects use method_missing now (@solnic)"
2020-01-31 12:07:29 +00:00
- version : 0.10 .0
2020-02-18 15:13:43 +00:00
summary : YANKED because the change also broke inheritance for classes that used
`configured` before other classes inherited from them.
2020-01-31 12:07:29 +00:00
date : '2020-01-31'
2022-10-07 23:04:31 +00:00
fixed :
added :
2020-01-31 12:07:29 +00:00
changed :
- Inheriting settings no longer defines the config object. This change fixed a use
case where parent class that already used its config would prevent a child class
from adding new settings (@solnic)
2020-01-17 09:24:49 +00:00
- version : 0.9 .0
date : '2019-11-06'
fixed :
- 'Support for reserved names in settings. Some Kernel methods (`public_send` and
`class` specifically) are not available if you use access settings via method
call. Same for methods of the `Config` class. You can still access them with `[]`
and `[]=`. Ruby keywords are fully supported. Invalid names containing special
symbols (including `!` and `?`) are rejected. Note that these changes don''t affect
the `reader` option, if you define a setting named `:class` and pass `reader :
true ` ... well ... (flash-gordon)'
- Settings can be redefined in subclasses without a warning about overriding exsting
methods (flash-gordon)
- Fix warnings about using keyword arguments in 2.7 (koic)
- version : 0.8 .3
date : '2019-05-29'
fixed :
- "`Configurable#dup` and `Configurable#clone` make a copy of instance-level config
so that it doesn't get mutated/shared across instances (flash-gordon)"
- version : 0.8 .2
date : '2019-02-25'
fixed :
- Test interface support for modules ([Neznauy](https://github.com/Neznauy))
- version : 0.8 .1
date : '2019-02-06'
fixed :
- "`.configure` doesn't require a block, this makes the behavior consistent with
the previous versions ([flash-gordon](https://github.com/flash-gordon))"
- version : 0.8 .0
date : '2019-02-05'
fixed :
- 'A number of bugs related to inheriting settings from parent class were fixed.
Ideally, new behavior will be :100 : predictable but if you observe any anomaly,
please report ([flash-gordon](https://github.com/flash-gordon))'
added :
- |-
Support for instance-level configuration landed. For usage, `include` the module instead of extending ([flash-gordon](https://github.com/flash-gordon))
```ruby
class App
include Dry::Configurable
setting :database
end
production = App.new
production.config.database = ENV['DATABASE_URL']
production.finalize!
development = App.new
development.config.database = 'jdbc:sqlite:memory'
development.finalize!
```
- |-
Config values can be set from a hash with `.update`. Nested settings are supported ([flash-gordon](https://github.com/flash-gordon))
```ruby
class App
extend Dry::Configurable
setting :db do
setting :host
setting :port
end
config.update(YAML.load(File.read("config.yml")))
end
```
changed :
- "[BREAKING] Minimal supported Ruby version is set to 2.3 ([flash-gordon](https://github.com/flash-gordon))"
- version : 0.7 .0
date : '2017-04-25'
added :
- Introduce `Configurable.finalize!` which freezes config and its dependencies ([qcam](https://github.com/qcam))
fixed :
- Allow for boolean false as default setting value ([yuszuv](https://github.com/yuszuv))
- Convert nested configs to nested hashes with `Config#to_h` ([saverio-kantox](https://github.com/saverio-kantox))
- Disallow modification on frozen config ([qcam](https://github.com/qcam))