dry-configurable 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc0b056757d51704455a5ce3cb4868f5081e2d85f5f2bcb07b855e44e8b28408
4
- data.tar.gz: 6bb906e0508a57daa383d3374b51f06a5fff34809b62ddedb6bbf51c31e23395
3
+ metadata.gz: 2ff9b3ce11ae6d520fadbd7f04393e37633a87f1c25b95940571001acc00a2d1
4
+ data.tar.gz: e0565497012afd70b45e1450f27dd00e0abd8e551a981dd4da94a64fbf5e5560
5
5
  SHA512:
6
- metadata.gz: 5728bfca629b6f2df8200eaaf10f4a31b7be0d685490a09073c6f4f8576a8db290d098321cc019734b6cbfb96b926e17123e41c5b7f97715f6ad22a37904d051
7
- data.tar.gz: b18967e737861334404162cacf90961b846cdb26a265cac429f672b0a8f4c29d40006ef9b6dd6ebd4e1653cb4af1bf225dbf69dd2cfbc50208edd92d8a41dc66
6
+ metadata.gz: b5e8c93e51308a677f9b43545632701ac31d394dd54897536b3310359b90cc242e948a8558f9e47b451d0ec394cc9626a5469bbad2639396f0445f1681f2a1cb
7
+ data.tar.gz: 1c33976cc72930fbdd8fce070655dddefa7585fe7b341c0e78515c89c2e2ea6e1cf447cd599db3f197b59ed0ec69ec797b65fb4ac7782bc3270ecb27af2f3b6c
data/CHANGELOG.md CHANGED
@@ -1,74 +1,99 @@
1
- <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
1
+ # Changelog
2
2
 
3
- ## 1.3.0 2025-01-04
3
+ All notable changes to this project will be documented in this file.
4
4
 
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Break Versioning](https://www.taoensso.com/break-versioning).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
5
11
 
6
12
  ### Changed
7
13
 
8
- - Set minimum Ruby version to 3.1 (@flash-gordon)
14
+ ### Deprecated
9
15
 
10
- [Compare v1.2.0...v1.3.0](https://github.com/dry-rb/dry-configurable/compare/v1.2.0...v1.3.0)
16
+ ### Removed
11
17
 
12
- ## 1.2.0 2024-07-03
18
+ ### Fixed
13
19
 
20
+ ### Security
14
21
 
15
- ### Changed
22
+ [Unreleased]: https://github.com/dry-rb/dry-configurable/compare/v1.4.0...main
23
+
24
+ ## [1.4.0] - 2026-05-13
16
25
 
17
- - Allow `Dry::Configurable` mixin to be included multiple times in a class hierarchy (#164 by @timriley)
18
- - Deprecate `Dry::Configurable::AlreadyIncludedError` (#164 by @timriley)
26
+ ### Added
19
27
 
20
- [Compare v1.1.0...v1.2.0](https://github.com/dry-rb/dry-configurable/compare/v1.1.0...v1.2.0)
28
+ - Added `Config#to_data`, returning a frozen `Data` representation of the config's resolved values for performance-sensitive read paths. (@cllns in #167)
21
29
 
22
- ## 1.1.0 2022-07-16
30
+ ### Changed
23
31
 
32
+ - Set minimum Ruby version to 3.3. (@alassek & @timriley)
24
33
 
25
- ### Fixed
34
+ [1.4.0]: https://github.com/dry-rb/dry-configurable/compare/v1.3.0...v1.4.0
26
35
 
27
- - Allow nested settings to default to `Undefined` (fixes #158 via #161) (@emptyflask)
36
+ ## [1.3.0] - 2025-01-04
28
37
 
38
+ ### Changed
29
39
 
30
- [Compare v1.0.1...v1.1.0](https://github.com/dry-rb/dry-configurable/compare/v1.0.1...v1.1.0)
40
+ - Set minimum Ruby version to 3.1. (@flash-gordon)
31
41
 
32
- ## 1.0.1 2022-11-16
42
+ [1.3.0]: https://github.com/dry-rb/dry-configurable/compare/v1.2.0...v1.3.0
33
43
 
44
+ ## [1.2.0] - 2024-07-03
34
45
 
35
46
  ### Changed
36
47
 
37
- - Renamed `@config` and `@_settings` internal instance variables to `@__config__` and `@__settings__` in order to avoid clashes with user-defined instance variables (#159 by @timriley)
48
+ - Allow `Dry::Configurable` mixin to be included multiple times in a class hierarchy. (@timriley in #164)
49
+ - Deprecate `Dry::Configurable::AlreadyIncludedError`. (@timriley in #164)
38
50
 
39
- [Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-configurable/compare/v1.0.0...v1.0.1)
51
+ [1.2.0]: https://github.com/dry-rb/dry-configurable/compare/v1.1.0...v1.2.0
40
52
 
41
- ## 1.0.0 2022-11-04
53
+ ## [1.1.0] - 2022-07-16
42
54
 
55
+ ### Fixed
43
56
 
44
- ### Changed
57
+ - Allow nested settings to default to `Undefined`. (@emptyflask in #161)
45
58
 
46
- - Dependency on `dry-core` was updated to ~> 1.0 (@solnic)
59
+ [1.1.0]: https://github.com/dry-rb/dry-configurable/compare/v1.0.1...v1.1.0
47
60
 
48
- [Compare v0.16.1...v1.0.0](https://github.com/dry-rb/dry-configurable/compare/v0.16.1...v1.0.0)
61
+ ## [1.0.1] - 2022-11-16
49
62
 
50
- ## 0.16.1 2022-10-13
63
+ ### Changed
64
+
65
+ - Renamed `@config` and `@_settings` internal instance variables to `@__config__` and `@__settings__` in order to avoid clashes with user-defined instance variables. (@timriley in #159)
66
+
67
+ [1.0.1]: https://github.com/dry-rb/dry-configurable/compare/v1.0.0...v1.0.1
51
68
 
69
+ ## [1.0.0] - 2022-11-04
52
70
 
53
71
  ### Changed
54
72
 
55
- - 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)
73
+ - Dependency on `dry-core` was updated to ~> 1.0. (@solnic)
56
74
 
57
- [Compare v0.16.0...v0.16.1](https://github.com/dry-rb/dry-configurable/compare/v0.16.0...v0.16.1)
75
+ [1.0.0]: https://github.com/dry-rb/dry-configurable/compare/v0.16.1...v1.0.0
76
+
77
+ ## [0.16.1] - 2022-10-13
78
+
79
+ ### Changed
58
80
 
59
- ## 0.16.0 2022-10-08
81
+ - 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. (@timriley in #149)
60
82
 
83
+ [0.16.1]: https://github.com/dry-rb/dry-configurable/compare/v0.16.0...v0.16.1
84
+
85
+ ## [0.16.0] - 2022-10-08
61
86
 
62
87
  ### Added
63
88
 
64
- - Support for custom config classes via `config_class:` option (#136 by @solnic)
89
+ - Support for custom config classes via `config_class:` option. (@solnic in #136)
65
90
 
66
91
  ```ruby
67
92
  extend Dry::Configurable(config_class: MyConfig)
68
93
  ```
69
94
 
70
95
  Your config class should inherit from `Dry::Configurable::Config`.
71
- - Return `Dry::Core::Constants::Undefined` (instead of nil) as the value for non-configured settings via a `default_undefined: true` option (#141 by @timriley)
96
+ - Return `Dry::Core::Constants::Undefined` (instead of nil) as the value for non-configured settings via a `default_undefined: true` option. (@timriley in #141)
72
97
 
73
98
  ```ruby
74
99
  extend Dry::Configurable(default_undefined: true)
@@ -78,23 +103,22 @@
78
103
 
79
104
  ### Fixed
80
105
 
81
- - Remove exec bit from version.rb (#139 by @Fryguy)
106
+ - Remove exec bit from version.rb. (@Fryguy in #139)
82
107
 
83
108
  ### Changed
84
109
 
85
- - Improve memory usage by separating setting definitions from config values (#138 by @timriley)
110
+ - Improve memory usage by separating setting definitions from config values. (@timriley in #138)
86
111
 
87
112
  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`.
88
- - Use Zeitwerk to speed up load time (#135 by @solnic)
89
-
90
- [Compare v0.15.0...v0.16.0](https://github.com/dry-rb/dry-configurable/compare/v0.15.0...v0.16.0)
113
+ - Use Zeitwerk to speed up load time. (@solnic in #135)
91
114
 
92
- ## 0.15.0 2022-04-21
115
+ [0.16.0]: https://github.com/dry-rb/dry-configurable/compare/v0.15.0...v0.16.0
93
116
 
117
+ ## [0.15.0] - 2022-04-21
94
118
 
95
119
  ### Changed
96
120
 
97
- - 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)
121
+ - 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. (@ojab in #105)
98
122
 
99
123
  ```ruby
100
124
  class MyConfigurable
@@ -107,7 +131,7 @@
107
131
  my_obj.finalize!(freeze_values: true)
108
132
  my_obj.config.db << "sql" # Will raise FrozenError
109
133
  ```
110
- - `Dry::Configurable::Config#update` will set hashes as values for non-nested settings (#131 by @ojab)
134
+ - `Dry::Configurable::Config#update` will set hashes as values for non-nested settings. (@ojab in #131)
111
135
 
112
136
  ```ruby
113
137
  class MyConfigurable
@@ -119,27 +143,25 @@
119
143
  MyConfigurable.config.update(sslcert: {pem: "cert", pass: "qwerty"})
120
144
  MyConfigurable.config.sslcert # => "certqwerty"
121
145
  ```
122
- - `Dry::Configurable::Config#update` will accept any values implicitly convertible to hash via `#to_hash` (#133 by @timriley)
123
-
124
- [Compare v0.14.0...v0.15.0](https://github.com/dry-rb/dry-configurable/compare/v0.14.0...v0.15.0)
146
+ - `Dry::Configurable::Config#update` will accept any values implicitly convertible to hash via `#to_hash`. (@timriley in #133)
125
147
 
126
- ## 0.14.0 2022-01-14
148
+ [0.15.0]: https://github.com/dry-rb/dry-configurable/compare/v0.14.0...v0.15.0
127
149
 
150
+ ## [0.14.0] - 2022-01-14
128
151
 
129
152
  ### Changed
130
153
 
131
- - Settings defined after an access to `config` will still be made available on that `config`. (#130 by @timriley)
132
- - Cloneable settings are cloned immediately upon assignment. (#130 by @timriley)
133
- - 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)
154
+ - Settings defined after an access to `config` will still be made available on that `config`. (@timriley in #130)
155
+ - Cloneable settings are cloned immediately upon assignment. (@timriley in #130)
156
+ - 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. (@timriley in #130)
134
157
 
135
- [Compare v0.13.0...v0.14.0](https://github.com/dry-rb/dry-configurable/compare/v0.13.0...v0.14.0)
136
-
137
- ## 0.13.0 2021-09-12
158
+ [0.14.0]: https://github.com/dry-rb/dry-configurable/compare/v0.13.0...v0.14.0
138
159
 
160
+ ## [0.13.0] - 2021-09-12
139
161
 
140
162
  ### Added
141
163
 
142
- - 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)
164
+ - 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. (@timriley in #124)
143
165
 
144
166
  ```ruby
145
167
  Dry::Configurable.warn_on_setting_constructor_block false
@@ -148,26 +170,25 @@
148
170
 
149
171
  ### Fixed
150
172
 
151
- - Fixed `ArgumentError` for classes including `Dry::Configurable` whose `initializer` has required kwargs. (#113 by @timriley)
173
+ - Fixed `ArgumentError` for classes including `Dry::Configurable` whose `initializer` has required kwargs. (@timriley in #113)
152
174
 
153
175
  ### Changed
154
176
 
155
- - Deprecated the setting constructor provided as a block. Provide it via the `constructor:` keyword argument instead. (#111 by @waiting-for-dev & @timriley)
177
+ - Deprecated the setting constructor provided as a block. Provide it via the `constructor:` keyword argument instead. (@waiting-for-dev & @timriley in #111)
156
178
 
157
179
  ```ruby
158
180
  setting :path, constructor: -> path { Pathname(path) }
159
181
  ```
160
- - 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)
182
+ - Deprecated the setting default provided as the second positional argument. Provide it via the `default:` keyword argument instead. (@waiting-for-dev & @timriley in #112 and #121)
161
183
 
162
184
  ```ruby
163
185
  setting :path, default: "some/default/path"
164
186
  ```
165
- - [BREAKING] Removed implicit `to_hash` conversion from `Config`. (#114 by @timriley)
166
-
167
- [Compare v0.12.1...v0.13.0](https://github.com/dry-rb/dry-configurable/compare/v0.12.1...v0.13.0)
187
+ - [BREAKING] Removed implicit `to_hash` conversion from `Config`. (@timriley in #114)
168
188
 
169
- ## 0.12.1 2021-02-15
189
+ [0.13.0]: https://github.com/dry-rb/dry-configurable/compare/v0.12.1...v0.13.0
170
190
 
191
+ ## [0.12.1] - 2021-02-15
171
192
 
172
193
  ### Added
173
194
 
@@ -177,7 +198,7 @@
177
198
  setting :component_dirs, Configuration::ComponentDirs.new, cloneable: true
178
199
  ```
179
200
 
180
- This change makes it possible to provide rich config values that carry their own
201
+ This change makes it possible to provide "rich" config values that carry their own
181
202
  configuration interface.
182
203
 
183
204
  In the above example, `ComponentDirs` could provide its own API for adding component
@@ -191,164 +212,143 @@ A custom cloneable setting value should provide its own `#initialize_copy` (used
191
212
  ### Fixed
192
213
 
193
214
  - Only `#initialize` instance method is prepended, leaving the rest of the instance
194
- methods to be included as normal again. This allows classes including
195
- `Dry::Configurable` to override instance methods with their own methods as required
196
- (@adam12 in #103)
215
+ methods to be included as normal again. This allows classes including
216
+ `Dry::Configurable` to override instance methods with their own methods as required. (@adam12 in #103)
197
217
 
218
+ [0.12.1]: https://github.com/dry-rb/dry-configurable/compare/v0.12.0...v0.12.1
198
219
 
199
- [Compare v0.12.0...v0.12.1](https://github.com/dry-rb/dry-configurable/compare/v0.12.0...v0.12.1)
200
-
201
- ## 0.12.0 2020-12-26
202
-
220
+ ## [0.12.0] - 2020-12-26
203
221
 
204
222
  ### Fixed
205
223
 
206
- - 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)
224
+ - Setting values provided by defaults and/or pre-processor blocks are no longer accidentally memoized across instances of classes including Dry::Configurable. (@timriley & @esparta in #99)
207
225
 
208
226
  ### Changed
209
227
 
210
- - 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)
211
- - Switched to equalizer from dry-core (@solnic)
212
-
213
- [Compare v0.11.6...v0.12.0](https://github.com/dry-rb/dry-configurable/compare/v0.11.6...v0.12.0)
228
+ - Instance behavior is now prepended, so that if you have your own `initialize`, calling `super` is no longer required. (@zabolotnov87 in #98)
229
+ - Switched to equalizer from dry-core. (@solnic)
214
230
 
215
- ## 0.11.6 2020-06-22
231
+ [0.12.0]: https://github.com/dry-rb/dry-configurable/compare/v0.11.6...v0.12.0
216
232
 
233
+ ## [0.11.6] - 2020-06-22
217
234
 
218
235
  ### Changed
219
236
 
220
- - A meaningful error is raised when the extension is included more than once (issue #89 fixed via #94) (@landongrindheim)
221
- - Evaluate setting input immediately when input is provided. This allows for earlier feedback from constructors designed to raise errors on invalid input (#95) (@timriley)
237
+ - A meaningful error is raised when the extension is included more than once. (@landongrindheim in #94)
238
+ - Evaluate setting input immediately when input is provided. This allows for earlier feedback from constructors designed to raise errors on invalid input. (@timriley in #95)
222
239
 
223
- [Compare v0.11.5...v0.11.6](https://github.com/dry-rb/dry-configurable/compare/v0.11.5...v0.11.6)
224
-
225
- ## 0.11.5 2020-03-23
240
+ [0.11.6]: https://github.com/dry-rb/dry-configurable/compare/v0.11.5...v0.11.6
226
241
 
242
+ ## [0.11.5] - 2020-03-23
227
243
 
228
244
  ### Fixed
229
245
 
230
- - 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)
246
+ - 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. (@timriley in #87)
231
247
 
232
248
  ### Changed
233
249
 
234
- - A meaningful error is raised when the extension is included more than once (issue #89 fixed via #94) (@landongrindheim)
235
-
236
- [Compare v0.11.4...v0.11.5](https://github.com/dry-rb/dry-configurable/compare/v0.11.4...v0.11.5)
250
+ - A meaningful error is raised when the extension is included more than once. (@landongrindheim in #94)
237
251
 
238
- ## 0.11.4 2020-03-16
252
+ [0.11.5]: https://github.com/dry-rb/dry-configurable/compare/v0.11.4...v0.11.5
239
253
 
254
+ ## [0.11.4] - 2020-03-16
240
255
 
241
256
  ### Fixed
242
257
 
243
- - `Config#update` returns `self` again (issue #60 fixed via #92) (@solnic)
258
+ - `Config#update` returns `self` again. (@solnic in #92)
244
259
 
245
260
  ### Changed
246
261
 
247
- - `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)
248
-
249
- [Compare v0.11.3...v0.11.4](https://github.com/dry-rb/dry-configurable/compare/v0.11.3...v0.11.4)
262
+ - `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)
250
263
 
251
- ## 0.11.3 2020-02-22
264
+ [0.11.4]: https://github.com/dry-rb/dry-configurable/compare/v0.11.3...v0.11.4
252
265
 
266
+ ## [0.11.3] - 2020-02-22
253
267
 
254
268
  ### Fixed
255
269
 
256
- - Retrieving settings by a string name works again (issue #82) (@waiting-for-dev)
270
+ - Retrieving settings by a string name works again. (@waiting-for-dev in #82)
257
271
 
272
+ [0.11.3]: https://github.com/dry-rb/dry-configurable/compare/v0.11.2...v0.11.3
258
273
 
259
- [Compare v0.11.2...v0.11.3](https://github.com/dry-rb/dry-configurable/compare/v0.11.2...v0.11.3)
260
-
261
- ## 0.11.2 2020-02-20
262
-
274
+ ## [0.11.2] - 2020-02-20
263
275
 
264
276
  ### Fixed
265
277
 
266
- - Warning about redefined `Setting#value` is gone (@solnic)
267
-
278
+ - Warning about redefined `Setting#value` is gone. (@solnic)
268
279
 
269
- [Compare v0.11.1...v0.11.2](https://github.com/dry-rb/dry-configurable/compare/v0.11.1...v0.11.2)
270
-
271
- ## 0.11.1 2020-02-18
280
+ [0.11.2]: https://github.com/dry-rb/dry-configurable/compare/v0.11.1...v0.11.2
272
281
 
282
+ ## [0.11.1] - 2020-02-18
273
283
 
274
284
  ### Fixed
275
285
 
276
- - You can use `:settings` as a config key again (issue #80) (@solnic)
277
- - Setting value is lazy-evaluated now, which fixes some cases where a constructor could crash with a `nil` value (@solnic)
278
-
286
+ - You can use `:settings` as a config key again. (@solnic in #80)
287
+ - Setting value is lazy-evaluated now, which fixes some cases where a constructor could crash with a `nil` value. (@solnic)
279
288
 
280
- [Compare v0.11.0...v0.11.1](https://github.com/dry-rb/dry-configurable/compare/v0.11.0...v0.11.1)
289
+ [0.11.1]: https://github.com/dry-rb/dry-configurable/compare/v0.11.0...v0.11.1
281
290
 
282
- ## 0.11.0 2020-02-15
291
+ ## [0.11.0] - 2020-02-15
283
292
 
284
293
  Complete rewrite of the library while keeping the public API intact. See #78 for a detailed overview.
285
294
 
286
295
  ### Changed
287
296
 
288
- - Accessing config in a parent class no longer prevents you from adding more settings in a child class (@solnic)
289
- - (internal) New low-level Setting and Config API (@solnic)
290
- - (internal) `config` objects use method_missing now (@solnic)
297
+ - Accessing config in a parent class no longer prevents you from adding more settings in a child class. (@solnic)
298
+ - (internal) New low-level Setting and Config API. (@solnic)
299
+ - (internal) `config` objects use method_missing now. (@solnic)
291
300
 
292
- [Compare v0.10.0...v0.11.0](https://github.com/dry-rb/dry-configurable/compare/v0.10.0...v0.11.0)
301
+ [0.11.0]: https://github.com/dry-rb/dry-configurable/compare/v0.10.0...v0.11.0
293
302
 
294
- ## 0.10.0 2020-01-31
303
+ ## [0.10.0] - 2020-01-31
295
304
 
296
305
  YANKED because the change also broke inheritance for classes that used `configured` before other classes inherited from them.
297
306
 
298
307
  ### Changed
299
308
 
300
- - 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)
309
+ - 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)
301
310
 
302
- [Compare v0.9.0...v0.10.0](https://github.com/dry-rb/dry-configurable/compare/v0.9.0...v0.10.0)
303
-
304
- ## 0.9.0 2019-11-06
311
+ [0.10.0]: https://github.com/dry-rb/dry-configurable/compare/v0.9.0...v0.10.0
305
312
 
313
+ ## [0.9.0] - 2019-11-06
306
314
 
307
315
  ### Fixed
308
316
 
309
- - 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)
310
- - Settings can be redefined in subclasses without a warning about overriding exsting methods (flash-gordon)
311
- - Fix warnings about using keyword arguments in 2.7 (koic)
312
-
313
-
314
- [Compare v0.8.3...v0.9.0](https://github.com/dry-rb/dry-configurable/compare/v0.8.3...v0.9.0)
317
+ - 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)
318
+ - Settings can be redefined in subclasses without a warning about overriding exsting methods. (@flash-gordon)
319
+ - Fix warnings about using keyword arguments in 2.7. (@koic)
315
320
 
316
- ## 0.8.3 2019-05-29
321
+ [0.9.0]: https://github.com/dry-rb/dry-configurable/compare/v0.8.3...v0.9.0
317
322
 
323
+ ## [0.8.3] - 2019-05-29
318
324
 
319
325
  ### Fixed
320
326
 
321
- - `Configurable#dup` and `Configurable#clone` make a copy of instance-level config so that it doesn't get mutated/shared across instances (flash-gordon)
327
+ - `Configurable#dup` and `Configurable#clone` make a copy of instance-level config so that it doesn't get mutated/shared across instances. (@flash-gordon)
322
328
 
329
+ [0.8.3]: https://github.com/dry-rb/dry-configurable/compare/v0.8.2...v0.8.3
323
330
 
324
- [Compare v0.8.2...v0.8.3](https://github.com/dry-rb/dry-configurable/compare/v0.8.2...v0.8.3)
325
-
326
- ## 0.8.2 2019-02-25
327
-
331
+ ## [0.8.2] - 2019-02-25
328
332
 
329
333
  ### Fixed
330
334
 
331
- - Test interface support for modules ([Neznauy](https://github.com/Neznauy))
332
-
335
+ - Test interface support for modules. (@Neznauy)
333
336
 
334
- [Compare v0.8.1...v0.8.2](https://github.com/dry-rb/dry-configurable/compare/v0.8.1...v0.8.2)
335
-
336
- ## 0.8.1 2019-02-06
337
+ [0.8.2]: https://github.com/dry-rb/dry-configurable/compare/v0.8.1...v0.8.2
337
338
 
339
+ ## [0.8.1] - 2019-02-06
338
340
 
339
341
  ### Fixed
340
342
 
341
- - `.configure` doesn't require a block, this makes the behavior consistent with the previous versions ([flash-gordon](https://github.com/flash-gordon))
342
-
343
-
344
- [Compare v0.8.0...v0.8.1](https://github.com/dry-rb/dry-configurable/compare/v0.8.0...v0.8.1)
343
+ - `.configure` doesn't require a block, this makes the behavior consistent with the previous versions. (@flash-gordon)
345
344
 
346
- ## 0.8.0 2019-02-05
345
+ [0.8.1]: https://github.com/dry-rb/dry-configurable/compare/v0.8.0...v0.8.1
347
346
 
347
+ ## [0.8.0] - 2019-02-05
348
348
 
349
349
  ### Added
350
350
 
351
- - Support for instance-level configuration landed. For usage, `include` the module instead of extending ([flash-gordon](https://github.com/flash-gordon))
351
+ - Support for instance-level configuration landed. For usage, `include` the module instead of extending. (@flash-gordon)
352
352
 
353
353
  ```ruby
354
354
  class App
@@ -365,7 +365,7 @@ YANKED because the change also broke inheritance for classes that used `configur
365
365
  development.config.database = 'jdbc:sqlite:memory'
366
366
  development.finalize!
367
367
  ```
368
- - Config values can be set from a hash with `.update`. Nested settings are supported ([flash-gordon](https://github.com/flash-gordon))
368
+ - Config values can be set from a hash with `.update`. Nested settings are supported. (@flash-gordon)
369
369
 
370
370
  ```ruby
371
371
  class App
@@ -382,23 +382,24 @@ YANKED because the change also broke inheritance for classes that used `configur
382
382
 
383
383
  ### Fixed
384
384
 
385
- - 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))
385
+ - 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)
386
386
 
387
387
  ### Changed
388
388
 
389
- - [BREAKING] Minimal supported Ruby version is set to 2.3 ([flash-gordon](https://github.com/flash-gordon))
389
+ - [BREAKING] Minimal supported Ruby version is set to 2.3. (@flash-gordon)
390
390
 
391
- [Compare v0.7.0...v0.8.0](https://github.com/dry-rb/dry-configurable/compare/v0.7.0...v0.8.0)
392
-
393
- ## 0.7.0 2017-04-25
391
+ [0.8.0]: https://github.com/dry-rb/dry-configurable/compare/v0.7.0...v0.8.0
394
392
 
393
+ ## [0.7.0] - 2017-04-25
395
394
 
396
395
  ### Added
397
396
 
398
- - Introduce `Configurable.finalize!` which freezes config and its dependencies ([qcam](https://github.com/qcam))
397
+ - Introduce `Configurable.finalize!` which freezes config and its dependencies. (@qcam)
399
398
 
400
399
  ### Fixed
401
400
 
402
- - Allow for boolean false as default setting value ([yuszuv](https://github.com/yuszuv))
403
- - Convert nested configs to nested hashes with `Config#to_h` ([saverio-kantox](https://github.com/saverio-kantox))
404
- - Disallow modification on frozen config ([qcam](https://github.com/qcam))
401
+ - Allow for boolean false as default setting value. (@yuszuv)
402
+ - Convert nested configs to nested hashes with `Config#to_h`. (@saverio-kantox)
403
+ - Disallow modification on frozen config. (@qcam)
404
+
405
+ [0.7.0]: https://github.com/dry-rb/dry-configurable/releases/tag/v0.7.0
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2023 dry-rb team
3
+ Copyright (c) 2015-2026 Hanakai team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -1,22 +1,22 @@
1
- <!--- this file is synced from dry-rb/template-gem project -->
2
- [gem]: https://rubygems.org/gems/dry-configurable
3
- [actions]: https://github.com/dry-rb/dry-configurable/actions
4
-
5
- # dry-configurable [![Gem Version](https://badge.fury.io/rb/dry-configurable.svg)][gem] [![CI Status](https://github.com/dry-rb/dry-configurable/workflows/CI/badge.svg)][actions]
1
+ <!--- This file is synced from hanakai-rb/repo-sync -->
6
2
 
7
- ## Links
3
+ [actions]: https://github.com/dry-rb/dry-configurable/actions
4
+ [chat]: https://discord.gg/naQApPAsZB
5
+ [forum]: https://discourse.hanamirb.org
6
+ [rubygem]: https://rubygems.org/gems/dry-configurable
8
7
 
9
- * [User documentation](https://dry-rb.org/gems/dry-configurable)
10
- * [API documentation](http://rubydoc.info/gems/dry-configurable)
11
- * [Forum](https://discourse.dry-rb.org)
8
+ # dry-configurable [![Gem Version](https://badge.fury.io/rb/dry-configurable.svg)][rubygem] [![CI Status](https://github.com/dry-rb/dry-configurable/workflows/CI/badge.svg)][actions]
12
9
 
13
- ## Supported Ruby versions
10
+ [![Forum](https://img.shields.io/badge/Forum-dc360f?logo=discourse&logoColor=white)][forum]
11
+ [![Chat](https://img.shields.io/badge/Chat-717cf8?logo=discord&logoColor=white)][chat]
14
12
 
15
- This library officially supports the following Ruby versions:
13
+ ## Links
16
14
 
17
- * MRI `>= 3.1`
18
- * jruby `>= 9.4` (not tested on CI)
15
+ - [User documentation](https://dry-rb.org/gems/dry-configurable)
16
+ - [API documentation](http://rubydoc.info/gems/dry-configurable)
17
+ - [Forum](https://discourse.dry-rb.org)
19
18
 
20
19
  ## License
21
20
 
22
21
  See `LICENSE` file.
22
+
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # this file is synced from dry-rb/template-gem project
3
+ # This file is synced from hanakai-rb/repo-sync. To update it, edit repo-sync.yml.
4
4
 
5
5
  lib = File.expand_path("lib", __dir__)
6
6
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
@@ -8,29 +8,32 @@ require "dry/configurable/version"
8
8
 
9
9
  Gem::Specification.new do |spec|
10
10
  spec.name = "dry-configurable"
11
- spec.authors = ["Andy Holland"]
12
- spec.email = ["andyholland1991@aol.com"]
11
+ spec.authors = ["Hanakai team"]
12
+ spec.email = ["info@hanakai.org"]
13
13
  spec.license = "MIT"
14
14
  spec.version = Dry::Configurable::VERSION.dup
15
15
 
16
16
  spec.summary = "A mixin to add configuration functionality to your classes"
17
17
  spec.description = spec.summary
18
18
  spec.homepage = "https://dry-rb.org/gems/dry-configurable"
19
- spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-configurable.gemspec",
20
- "lib/**/*"]
21
- spec.bindir = "bin"
22
- spec.executables = []
19
+ spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-configurable.gemspec", "lib/**/*"]
20
+ spec.bindir = "exe"
21
+ spec.executables = Dir["exe/*"].map { |f| File.basename(f) }
23
22
  spec.require_paths = ["lib"]
24
23
 
25
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
26
- spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-configurable/blob/main/CHANGELOG.md"
27
- spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-configurable"
28
- spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-configurable/issues"
29
- spec.metadata["rubygems_mfa_required"] = "true"
24
+ spec.extra_rdoc_files = ["README.md", "CHANGELOG.md", "LICENSE"]
30
25
 
31
- spec.required_ruby_version = ">= 3.1"
26
+ spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-configurable/blob/main/CHANGELOG.md"
27
+ spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-configurable"
28
+ spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-configurable/issues"
29
+ spec.metadata["funding_uri"] = "https://github.com/sponsors/hanami"
32
30
 
33
- # to update dependencies edit project.yml
34
- spec.add_dependency "dry-core", "~> 1.1"
35
- spec.add_dependency "zeitwerk", "~> 2.6"
31
+ spec.required_ruby_version = ">= 3.3"
32
+
33
+ spec.add_runtime_dependency "zeitwerk", "~> 2.6"
34
+ spec.add_runtime_dependency "dry-core", "~> 1.0"
35
+ spec.add_development_dependency "bundler"
36
+ spec.add_development_dependency "rake"
37
+ spec.add_development_dependency "rspec"
36
38
  end
39
+
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module Dry
6
4
  module Configurable
7
5
  module ClassMethods
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module Dry
6
4
  module Configurable
7
5
  # Config exposes setting values through a convenient API
@@ -142,7 +140,7 @@ module Dry
142
140
  #
143
141
  # @api public
144
142
  def to_h
145
- values.to_h { |key, value| [key, value.is_a?(self.class) ? value.to_h : value] }
143
+ values.transform_values { |value| value.is_a?(self.class) ? value.to_h : value }
146
144
  end
147
145
 
148
146
  # @api private
@@ -155,6 +153,48 @@ module Dry
155
153
  _dry_equalizer_hash
156
154
  end
157
155
 
156
+ # Returns a frozen {Data} representation of the config's resolved values.
157
+ #
158
+ # The Data exposes each setting as a real method, sidestepping the {method_missing}
159
+ # dispatch on the read path. Intended for performance-sensitive code that reads the same
160
+ # config repeatedly (e.g. per-request render hot paths). A new object is returned per call,
161
+ # so consumers should memoize the result.
162
+ #
163
+ # Only available on a finalized config. Nested configs are converted recursively to nested
164
+ # Data instances. Values are captured by reference, so in-place mutation of a captured
165
+ # value remains visible through the Data; finalize with `freeze_values: true` if you want
166
+ # to prevent that.
167
+ #
168
+ # The returned Data uses Ruby's default structural `==`/`eql?`/`hash`. If you want to use
169
+ # it as an identity-based cache key (e.g. to skip walking N members on every lookup),
170
+ # memoize the reference yourself and either:
171
+ #
172
+ # 1. key it by `object_id` directly:
173
+ #
174
+ # @cached = view_class.config.to_data
175
+ # cache[@cached.object_id] = ...
176
+ #
177
+ # 2. use a `compare_by_identity` cache:
178
+ #
179
+ # cache = {}.compare_by_identity
180
+ # cache[@cached] = ...
181
+ #
182
+ # Either avoids the contract-breaking `hash = object_id` override and keeps Data's
183
+ # structural equality available for general use.
184
+ #
185
+ # @return [Data]
186
+ #
187
+ # @raise [FrozenConfigError] if the config is not yet finalized
188
+ #
189
+ # @api public
190
+ def to_data
191
+ unless frozen?
192
+ raise FrozenConfigError, "config must be finalized before #to_data can be called"
193
+ end
194
+
195
+ _settings.data_class.new(**to_data_attrs)
196
+ end
197
+
158
198
  # @api public
159
199
  def finalize!(freeze_values: false)
160
200
  return self if frozen?
@@ -184,6 +224,12 @@ module Dry
184
224
 
185
225
  private
186
226
 
227
+ def to_data_attrs
228
+ _values.each_with_object({}) do |(name, value), hsh|
229
+ hsh[name] = value.is_a?(self.class) ? value.to_data : value
230
+ end
231
+ end
232
+
187
233
  def method_missing(name, *args)
188
234
  setting_name = setting_name_from_method(name)
189
235
  setting = _settings[setting_name]
@@ -8,6 +8,10 @@ module Dry
8
8
  class DSL
9
9
  VALID_NAME = /\A[a-z_]\w*\z/i
10
10
 
11
+ # Method names defined on `Data` (and its ancestors) that cannot be used as setting
12
+ # names because `Data.define` would reject them, which would break {Config#to_data}.
13
+ DATA_RESERVED_NAMES = ::Data.instance_methods.to_set.freeze
14
+
11
15
  attr_reader :compiler
12
16
 
13
17
  attr_reader :ast
@@ -31,6 +35,12 @@ module Dry
31
35
  raise ArgumentError, "#{name} is not a valid setting name"
32
36
  end
33
37
 
38
+ if DATA_RESERVED_NAMES.include?(name.to_sym)
39
+ raise ArgumentError,
40
+ "#{name.inspect} is not a valid setting name: it conflicts with a Data " \
41
+ "instance method, which would break Config#to_data"
42
+ end
43
+
34
44
  ensure_valid_options(options)
35
45
 
36
46
  options = {default: default, config_class: config_class, **options}
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module Dry
6
4
  module Configurable
7
5
  # A defined setting.
@@ -21,14 +21,26 @@ module Dry
21
21
  # @api private
22
22
  private def initialize_copy(source)
23
23
  @settings = source.settings.dup
24
+ @data_class = nil
24
25
  end
25
26
 
26
27
  # @api private
27
28
  def <<(setting)
29
+ @data_class = nil
28
30
  settings[setting.name] = setting
29
31
  self
30
32
  end
31
33
 
34
+ # Returns a {Data} class with one member per defined setting, memoized for the lifetime of
35
+ # the schema. Invalidated when new settings are added.
36
+ #
37
+ # @return [Class]
38
+ #
39
+ # @api private
40
+ def data_class
41
+ @data_class ||= Data.define(*keys)
42
+ end
43
+
32
44
  # Returns the setting for the given name, if found.
33
45
  #
34
46
  # @return [Setting, nil] the setting, or nil if not found
@@ -3,6 +3,6 @@
3
3
  module Dry
4
4
  module Configurable
5
5
  # @api public
6
- VERSION = "1.3.0"
6
+ VERSION = "1.4.0"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,49 +1,93 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-configurable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
- - Andy Holland
8
- autorequire:
9
- bindir: bin
7
+ - Hanakai team
8
+ bindir: exe
10
9
  cert_chain: []
11
- date: 2025-01-06 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: dry-core
13
+ name: zeitwerk
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '1.1'
18
+ version: '2.6'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '1.1'
25
+ version: '2.6'
27
26
  - !ruby/object:Gem::Dependency
28
- name: zeitwerk
27
+ name: dry-core
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '2.6'
32
+ version: '1.0'
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: '2.6'
39
+ version: '1.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: bundler
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rake
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: rspec
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
41
82
  description: A mixin to add configuration functionality to your classes
42
83
  email:
43
- - andyholland1991@aol.com
84
+ - info@hanakai.org
44
85
  executables: []
45
86
  extensions: []
46
- extra_rdoc_files: []
87
+ extra_rdoc_files:
88
+ - CHANGELOG.md
89
+ - LICENSE
90
+ - README.md
47
91
  files:
48
92
  - CHANGELOG.md
49
93
  - LICENSE
@@ -68,12 +112,10 @@ homepage: https://dry-rb.org/gems/dry-configurable
68
112
  licenses:
69
113
  - MIT
70
114
  metadata:
71
- allowed_push_host: https://rubygems.org
72
115
  changelog_uri: https://github.com/dry-rb/dry-configurable/blob/main/CHANGELOG.md
73
116
  source_code_uri: https://github.com/dry-rb/dry-configurable
74
117
  bug_tracker_uri: https://github.com/dry-rb/dry-configurable/issues
75
- rubygems_mfa_required: 'true'
76
- post_install_message:
118
+ funding_uri: https://github.com/sponsors/hanami
77
119
  rdoc_options: []
78
120
  require_paths:
79
121
  - lib
@@ -81,15 +123,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
123
  requirements:
82
124
  - - ">="
83
125
  - !ruby/object:Gem::Version
84
- version: '3.1'
126
+ version: '3.3'
85
127
  required_rubygems_version: !ruby/object:Gem::Requirement
86
128
  requirements:
87
129
  - - ">="
88
130
  - !ruby/object:Gem::Version
89
131
  version: '0'
90
132
  requirements: []
91
- rubygems_version: 3.3.27
92
- signing_key:
133
+ rubygems_version: 3.6.9
93
134
  specification_version: 4
94
135
  summary: A mixin to add configuration functionality to your classes
95
136
  test_files: []