dry-initializer 3.0.3 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +234 -242
- data/dry-initializer.gemspec +28 -15
- data/lib/dry/initializer/builders/attribute.rb +1 -1
- data/lib/dry/initializer/version.rb +1 -1
- metadata +24 -104
- data/.codeclimate.yml +0 -12
- data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +0 -10
- data/.github/ISSUE_TEMPLATE/---bug-report.md +0 -30
- data/.github/ISSUE_TEMPLATE/---feature-request.md +0 -18
- data/.github/workflows/custom_ci.yml +0 -58
- data/.github/workflows/docsite.yml +0 -34
- data/.github/workflows/sync_configs.yml +0 -56
- data/.gitignore +0 -12
- data/.rspec +0 -4
- data/.rubocop.yml +0 -102
- data/CODE_OF_CONDUCT.md +0 -13
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -36
- data/Gemfile.devtools +0 -16
- data/Guardfile +0 -5
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -8
- data/benchmarks/compare_several_defaults.rb +0 -82
- data/benchmarks/plain_options.rb +0 -63
- data/benchmarks/plain_params.rb +0 -84
- data/benchmarks/with_coercion.rb +0 -71
- data/benchmarks/with_defaults.rb +0 -66
- data/benchmarks/with_defaults_and_coercion.rb +0 -59
- data/bin/.gitkeep +0 -0
- data/docsite/source/attributes.html.md +0 -106
- data/docsite/source/container-version.html.md +0 -39
- data/docsite/source/index.html.md +0 -43
- data/docsite/source/inheritance.html.md +0 -43
- data/docsite/source/optionals-and-defaults.html.md +0 -130
- data/docsite/source/options-tolerance.html.md +0 -27
- data/docsite/source/params-and-options.html.md +0 -74
- data/docsite/source/rails-support.html.md +0 -101
- data/docsite/source/readers.html.md +0 -43
- data/docsite/source/skip-undefined.html.md +0 -59
- data/docsite/source/type-constraints.html.md +0 -160
- data/project.yml +0 -2
- data/spec/attributes_spec.rb +0 -38
- data/spec/coercion_of_nil_spec.rb +0 -25
- data/spec/custom_dispatchers_spec.rb +0 -35
- data/spec/custom_initializer_spec.rb +0 -30
- data/spec/default_values_spec.rb +0 -83
- data/spec/definition_spec.rb +0 -111
- data/spec/invalid_default_spec.rb +0 -13
- data/spec/list_type_spec.rb +0 -32
- data/spec/missed_default_spec.rb +0 -14
- data/spec/nested_type_spec.rb +0 -48
- data/spec/optional_spec.rb +0 -71
- data/spec/options_tolerance_spec.rb +0 -11
- data/spec/public_attributes_utility_spec.rb +0 -22
- data/spec/reader_spec.rb +0 -87
- data/spec/repetitive_definitions_spec.rb +0 -69
- data/spec/several_assignments_spec.rb +0 -41
- data/spec/spec_helper.rb +0 -24
- data/spec/subclassing_spec.rb +0 -49
- data/spec/support/coverage.rb +0 -7
- data/spec/support/warnings.rb +0 -7
- data/spec/type_argument_spec.rb +0 -35
- data/spec/type_constraint_spec.rb +0 -96
- data/spec/value_coercion_via_dry_types_spec.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d1722e29cdab2ffcf349bc159451afb795aa399c91e0ebae2296318a5b3b166
|
4
|
+
data.tar.gz: 4e6a589a9898e6701dcadbd321d78041da27e58f783bfbfa566d828134f6c081
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66596268197d4fc509eb9cc5dfd738af4d3d4f6c33a861cc4877328817d7a28155de3987c8df3b6fdc868bfec346a3e8dd67891f702ead9e47142c756ad306bf
|
7
|
+
data.tar.gz: c4f91414ec4798759ed48b783974f922d598c01e613116c8fd077ed3c886a376c0ba260928ef3788ff0f7984cdc086cc03d3404052a97f2cb8c1658c7913cc69
|
data/CHANGELOG.md
CHANGED
@@ -1,23 +1,35 @@
|
|
1
|
-
|
1
|
+
## 3.0.4 2020-09-29
|
2
2
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
4
3
|
|
5
|
-
|
6
|
-
|
4
|
+
### Fixed
|
5
|
+
|
6
|
+
- Arity check for lambdas used for coercion (@flash-gordon)
|
7
|
+
|
8
|
+
|
9
|
+
[Compare v3.0.3...v3.0.4](https://github.com/dry-rb/dry-initializer/compare/v3.0.3...v3.0.4)
|
10
|
+
|
11
|
+
## 3.0.3 2020-01-08
|
7
12
|
|
8
|
-
## [3.0.3] [2020-01-08]
|
9
13
|
|
10
14
|
### Fixed
|
11
15
|
|
12
16
|
- Constrained member arrays work correctly now (see #33) (@bjeanes + @solnic)
|
13
17
|
|
14
|
-
|
18
|
+
|
19
|
+
[Compare v3.0.2...v3.0.3](https://github.com/dry-rb/dry-initializer/compare/v3.0.2...v3.0.3)
|
20
|
+
|
21
|
+
## 3.0.2 2019-11-07
|
22
|
+
|
15
23
|
|
16
24
|
### Fixed
|
17
25
|
|
18
26
|
- Warnings about keyword arguments (flash-gordon)
|
19
27
|
|
20
|
-
|
28
|
+
|
29
|
+
[Compare v3.0.1...v3.0.2](https://github.com/dry-rb/dry-initializer/compare/v3.0.1...v3.0.2)
|
30
|
+
|
31
|
+
## 3.0.1 2019-04-15
|
32
|
+
|
21
33
|
|
22
34
|
### Fixed
|
23
35
|
|
@@ -51,7 +63,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
51
63
|
This restriction is necessary because we constantize option/param names
|
52
64
|
when defining nested structs.
|
53
65
|
|
54
|
-
|
66
|
+
|
67
|
+
[Compare v3.0.0...v3.0.1](https://github.com/dry-rb/dry-initializer/compare/v3.0.0...v3.0.1)
|
68
|
+
|
69
|
+
## 3.0.0 2019-04-14
|
70
|
+
|
55
71
|
|
56
72
|
### Added
|
57
73
|
|
@@ -67,7 +83,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
67
83
|
test = Test.new(42)
|
68
84
|
test.foo # => ["42"]
|
69
85
|
```
|
70
|
-
|
71
86
|
- It works with several layers of nesting (nepalez)
|
72
87
|
|
73
88
|
```ruby
|
@@ -80,7 +95,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
80
95
|
test = Test.new(42)
|
81
96
|
test.foo # => [["42"]]
|
82
97
|
```
|
83
|
-
|
84
98
|
- Support of nested types/coercers (nepalez)
|
85
99
|
|
86
100
|
```ruby
|
@@ -95,7 +109,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
95
109
|
test = Test.new(bar: { "baz" => 42 })
|
96
110
|
test.foo.bar.baz # => "42"
|
97
111
|
```
|
98
|
-
|
99
112
|
- Wrapped/nested combinations are supported as well (nepalez)
|
100
113
|
|
101
114
|
```ruby
|
@@ -108,8 +121,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
108
121
|
test = Test.new(bar: 42)
|
109
122
|
test.foo.first.bar # => "42"
|
110
123
|
```
|
111
|
-
|
112
|
-
## [2.7.0] Unreleazed
|
124
|
+
- ## [2.7.0] Unreleazed
|
113
125
|
|
114
126
|
### Fixed
|
115
127
|
|
@@ -121,10 +133,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
121
133
|
The version [2.6.0] has been yanked on rubygems, so the master
|
122
134
|
was rolled back to the previous state until the reason for
|
123
135
|
the incompatibility become clear (bjeanes, nepalez)
|
136
|
+
- ## [2.6.0] [2018-09-09] (YANKED)
|
137
|
+
|
124
138
|
|
125
|
-
|
139
|
+
[Compare v2.5.0...v3.0.0](https://github.com/dry-rb/dry-initializer/compare/v2.5.0...v3.0.0)
|
140
|
+
|
141
|
+
## 2.5.0 2018-08-17
|
126
142
|
|
127
|
-
## [2.5.0] [2018-08-17]
|
128
143
|
|
129
144
|
### Fixed
|
130
145
|
|
@@ -134,9 +149,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
134
149
|
the coercion should be applied to any value, including `nil`, because
|
135
150
|
we cannot distinct "undefined" `nil` from the "assigned" `nil` value.
|
136
151
|
|
137
|
-
|
152
|
+
|
153
|
+
[Compare v2.4.0...v2.5.0](https://github.com/dry-rb/dry-initializer/compare/v2.4.0...v2.5.0)
|
154
|
+
|
155
|
+
## 2.4.0 2018-02-01
|
156
|
+
|
138
157
|
|
139
158
|
### Added
|
159
|
+
|
140
160
|
- Dispatchers for adding syntax sugar to `param` and `options` (nepalez)
|
141
161
|
|
142
162
|
```ruby
|
@@ -150,9 +170,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
150
170
|
end
|
151
171
|
```
|
152
172
|
|
153
|
-
|
173
|
+
|
174
|
+
[Compare v2.3.0...v2.4.0](https://github.com/dry-rb/dry-initializer/compare/v2.3.0...v2.4.0)
|
175
|
+
|
176
|
+
## 2.3.0 2017-09-19
|
177
|
+
|
154
178
|
|
155
179
|
### Added
|
180
|
+
|
156
181
|
- Type coercer can take second argument for the initialized instance (nepalez)
|
157
182
|
This allows to wrap assigned value to the object that refers back
|
158
183
|
to the initializer instance. More verbose example:
|
@@ -179,11 +204,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
179
204
|
offset.location.parameter == offset # true
|
180
205
|
```
|
181
206
|
|
182
|
-
|
207
|
+
|
208
|
+
[Compare v2.2.0...v2.3.0](https://github.com/dry-rb/dry-initializer/compare/v2.2.0...v2.3.0)
|
209
|
+
|
210
|
+
## 2.2.0 2017-09-13
|
211
|
+
|
183
212
|
|
184
213
|
### Added
|
185
|
-
- Option `:desc` for option/param to add a description (nepalez)
|
186
214
|
|
215
|
+
- Option `:desc` for option/param to add a description (nepalez)
|
187
216
|
- Methods `Definition#inch` and `Config#inch` to inspect definitions (nepalez)
|
188
217
|
|
189
218
|
```ruby
|
@@ -201,9 +230,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
201
230
|
# @return [User]
|
202
231
|
```
|
203
232
|
|
204
|
-
|
233
|
+
|
234
|
+
[Compare v2.1.0...v2.2.0](https://github.com/dry-rb/dry-initializer/compare/v2.1.0...v2.2.0)
|
235
|
+
|
236
|
+
## 2.1.0 2017-09-11
|
237
|
+
|
205
238
|
|
206
239
|
### Added
|
240
|
+
|
207
241
|
- Method `#options` to param/option definition (nepalez)
|
208
242
|
|
209
243
|
```ruby
|
@@ -225,28 +259,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
225
259
|
This method can be helpful for replicating params/options
|
226
260
|
in another class without inheritance.
|
227
261
|
|
228
|
-
## [2.0.0] [2017-08-28]
|
229
262
|
|
230
|
-
|
231
|
-
interface about the same (see "Deleted" section below for the only
|
232
|
-
backward-incompatible change).
|
263
|
+
[Compare v2.0.0...v2.1.0](https://github.com/dry-rb/dry-initializer/compare/v2.0.0...v2.1.0)
|
233
264
|
|
234
|
-
|
235
|
-
change in params/options of superclass wasn't reflected in its
|
236
|
-
previously declared subclasses.
|
265
|
+
## 2.0.0 2017-08-28
|
237
266
|
|
238
|
-
Thanks to @solnic for the idea of class-level container,
|
239
267
|
and to @gzigzigzeo for persuading me to do this refactoring.
|
240
268
|
|
241
|
-
### Deleted
|
242
|
-
- Undocumented variable `@__option__` which was the main reason for refactoring
|
243
|
-
(gzigzigzeo, nepalez).
|
244
|
-
|
245
269
|
### Added
|
270
|
+
|
246
271
|
- Class method `.dry_initializer` -- a container for `.params` and `.options`
|
247
272
|
`.definitions` along with the `.null` setting (either `nil` or `UNDEFINED`)
|
248
273
|
used for unassigned values (nepalez)
|
249
|
-
|
250
274
|
- `.dry_initializer.attributes` method takes an instance of the same class
|
251
275
|
and returns the hash of assigned options. This provide the same
|
252
276
|
functionality as previously used instance variable `@__options__` (nepalez)
|
@@ -265,7 +289,6 @@ and to @gzigzigzeo for persuading me to do this refactoring.
|
|
265
289
|
|
266
290
|
Both methods `.dry_initializer` and `#__dry_initializer_config__` refer
|
267
291
|
to the same object.
|
268
|
-
|
269
292
|
- `.dry_initializer.public_attributes`. This method works differently:
|
270
293
|
it looks through (possibly reloaded) readers instead of variables
|
271
294
|
(gzigzigzeo, nepalez)
|
@@ -277,6 +300,7 @@ and to @gzigzigzeo for persuading me to do this refactoring.
|
|
277
300
|
You can use the same trick as above mutatis mutandis.
|
278
301
|
|
279
302
|
### Fixed
|
303
|
+
|
280
304
|
- Definition order dependency bug (nepalez)
|
281
305
|
|
282
306
|
I've found out that if you provided a subclass and then changed params
|
@@ -288,7 +312,6 @@ and to @gzigzigzeo for persuading me to do this refactoring.
|
|
288
312
|
of the tree, and reloads their defintitions.
|
289
313
|
|
290
314
|
Being done in load time, the rebuilt makes no effect on runtime performance.
|
291
|
-
|
292
315
|
- Possible misbehavior when you define param and option with the same name (nepalez)
|
293
316
|
|
294
317
|
Doing this will provide `option :name` only, not both:
|
@@ -297,7 +320,6 @@ and to @gzigzigzeo for persuading me to do this refactoring.
|
|
297
320
|
param :name
|
298
321
|
option :name
|
299
322
|
```
|
300
|
-
|
301
323
|
- Attempt to redefine param/option of superclass with option/param in
|
302
324
|
its subclass will cause an exception because it would break
|
303
325
|
Liskov substitute principle with unexpected behaviour (nepalez)
|
@@ -314,7 +336,6 @@ and to @gzigzigzeo for persuading me to do this refactoring.
|
|
314
336
|
option :name
|
315
337
|
end
|
316
338
|
```
|
317
|
-
|
318
339
|
- When you reloading previously defined param of superclass, the gem
|
319
340
|
will check all its descendands for whether all required positional params
|
320
341
|
goes before optional ones (nepalez)
|
@@ -339,6 +360,7 @@ and to @gzigzigzeo for persuading me to do this refactoring.
|
|
339
360
|
```
|
340
361
|
|
341
362
|
### Changed
|
363
|
+
|
342
364
|
- Under the hood I've separated param/option settings declaration (a container
|
343
365
|
with param/option settings) from code builders for initializer and readers
|
344
366
|
(nepalez)
|
@@ -371,7 +393,6 @@ and to @gzigzigzeo for persuading me to do this refactoring.
|
|
371
393
|
|
372
394
|
You can check null value via `.dry_initializer.null` which is different
|
373
395
|
for `Dry::Initializer` and `Dry::Initializer[undefined: false]` modules.
|
374
|
-
|
375
396
|
- Optimized the code for `__initializer__`-s (the method where all magics occurs)
|
376
397
|
(nepalez)
|
377
398
|
|
@@ -422,31 +443,38 @@ and to @gzigzigzeo for persuading me to do this refactoring.
|
|
422
443
|
virtus: 180272.6 i/s - 15.99x slower
|
423
444
|
```
|
424
445
|
|
425
|
-
|
446
|
+
[Compare v1.4.1...v2.0.0](https://github.com/dry-rb/dry-initializer/compare/v1.4.1...v2.0.0)
|
447
|
+
|
448
|
+
## 1.4.1 2017-04-05
|
449
|
+
|
426
450
|
|
427
451
|
### Fixed
|
452
|
+
|
428
453
|
- Warning about redefined `#initialize` in case the method reloaded in a klass
|
429
454
|
that extends the module (nepalez, sergey-chechaev)
|
430
455
|
|
431
456
|
### Changed
|
457
|
+
|
432
458
|
- Rename `Dry::Initializer::DSL` -> `Dry::Initializer::ClassDSL` (nepalez)
|
433
459
|
- Add `Dry::Initializer::InstanceDSL` (nepalez)
|
434
460
|
|
435
|
-
|
436
|
-
|
437
|
-
|
461
|
+
[Compare v1.4.0...v1.4.1](https://github.com/dry-rb/dry-initializer/compare/v1.4.0...v1.4.1)
|
462
|
+
|
463
|
+
## 1.4.0 2017-03-08
|
438
464
|
|
439
|
-
This story will come to the end in `v2.1.0`.
|
440
465
|
|
441
|
-
|
466
|
+
### Changed
|
442
467
|
|
443
|
-
### Changed (backward-incompatible)
|
444
468
|
- The `@__options__` hash now collects all assigned attributes,
|
445
469
|
collected via `#option` (as before), and `#param` (nepalez)
|
446
470
|
|
447
|
-
|
471
|
+
[Compare v1.3.0...v1.4.0](https://github.com/dry-rb/dry-initializer/compare/v1.3.0...v1.4.0)
|
472
|
+
|
473
|
+
## 1.3.0 2017-03-05
|
474
|
+
|
448
475
|
|
449
476
|
### Added
|
477
|
+
|
450
478
|
- No-undefined configuration of the initializer (nepalez, flash-gordon)
|
451
479
|
|
452
480
|
You can either extend or include module `Dry::Initializer` with additional option
|
@@ -469,31 +497,55 @@ and to @gzigzigzeo for persuading me to do this refactoring.
|
|
469
497
|
Bar.new.instance_variable_get(:@qux) # => nil
|
470
498
|
|
471
499
|
### Changed
|
500
|
+
|
472
501
|
- Fixed method definitions for performance at the load time (nepalez, flash-gordon)
|
473
502
|
|
474
|
-
|
503
|
+
[Compare v1.2.0...v1.3.0](https://github.com/dry-rb/dry-initializer/compare/v1.2.0...v1.3.0)
|
504
|
+
|
505
|
+
## 1.2.0 2017-03-05
|
506
|
+
|
475
507
|
|
476
508
|
### Fixed
|
509
|
+
|
477
510
|
- The `@__options__` variable collects renamed options after default values and coercions were applied (nepalez)
|
478
511
|
|
479
|
-
|
512
|
+
|
513
|
+
[Compare v1.1.3...v1.2.0](https://github.com/dry-rb/dry-initializer/compare/v1.1.3...v1.2.0)
|
514
|
+
|
515
|
+
## 1.1.3 2017-03-01
|
516
|
+
|
480
517
|
|
481
518
|
### Added
|
519
|
+
|
482
520
|
- Support for lambdas as default values (nepalez, gzigzigzeo)
|
483
521
|
|
484
|
-
|
522
|
+
|
523
|
+
[Compare v1.1.2...v1.1.3](https://github.com/dry-rb/dry-initializer/compare/v1.1.2...v1.1.3)
|
524
|
+
|
525
|
+
## 1.1.2 2017-02-06
|
526
|
+
|
485
527
|
|
486
528
|
### Changed
|
529
|
+
|
487
530
|
- Remove previously defined methods before redefining them (flash-gordon)
|
488
531
|
|
489
|
-
|
532
|
+
[Compare v1.1.1...v1.1.2](https://github.com/dry-rb/dry-initializer/compare/v1.1.1...v1.1.2)
|
533
|
+
|
534
|
+
## 1.1.1 2017-02-04
|
535
|
+
|
490
536
|
|
491
537
|
### Fixed
|
538
|
+
|
492
539
|
- `@__options__` collects defined options only (nepalez)
|
493
540
|
|
494
|
-
|
541
|
+
|
542
|
+
[Compare v1.1.0...v1.1.1](https://github.com/dry-rb/dry-initializer/compare/v1.1.0...v1.1.1)
|
543
|
+
|
544
|
+
## 1.1.0 2017-01-28
|
545
|
+
|
495
546
|
|
496
547
|
### Added
|
548
|
+
|
497
549
|
- enhancement via `Dry::Initializer::Attribute.dispatchers` registry (nepalez)
|
498
550
|
|
499
551
|
```ruby
|
@@ -512,18 +564,17 @@ and to @gzigzigzeo for persuading me to do this refactoring.
|
|
512
564
|
```
|
513
565
|
|
514
566
|
### Changed
|
515
|
-
- optimize assignments for performance (nepalez)
|
516
567
|
|
517
|
-
|
568
|
+
- optimize assignments for performance (nepalez)
|
518
569
|
|
519
|
-
|
570
|
+
[Compare v1.0.0...v1.1.0](https://github.com/dry-rb/dry-initializer/compare/v1.0.0...v1.1.0)
|
520
571
|
|
521
|
-
|
522
|
-
- [BREAKING] when `param` or `option` was not defined, the corresponding **variable** is set to `Dry::Initializer::UNDEFINED`, but the **reader** (when defined) will return `nil` (nepalez)
|
572
|
+
## 1.0.0 2017-01-22
|
523
573
|
|
524
|
-
|
574
|
+
In this version the code has been rewritten for simplicity
|
525
575
|
|
526
576
|
### Added
|
577
|
+
|
527
578
|
- support for reloading `param` and `option` definitions (nepalez)
|
528
579
|
|
529
580
|
class User
|
@@ -540,7 +591,6 @@ In this version the code has been rewritten for simplicity
|
|
540
591
|
|
541
592
|
# order of the param not changed
|
542
593
|
Admin.new.name # => "Merlin"
|
543
|
-
|
544
594
|
- support for assignment of attributes via several options (nepalez)
|
545
595
|
|
546
596
|
class User
|
@@ -553,244 +603,241 @@ In this version the code has been rewritten for simplicity
|
|
553
603
|
User.new(phone: '1234567890').phone # => '1234567890'
|
554
604
|
User.new(number: '1234567890').phone # => '1234567890'
|
555
605
|
|
556
|
-
|
606
|
+
### Changed
|
607
|
+
|
608
|
+
- [BREAKING] when `param` or `option` was not defined, the corresponding **variable** is set to `Dry::Initializer::UNDEFINED`, but the **reader** (when defined) will return `nil` (nepalez)
|
609
|
+
- `Dry::Initializer` and `Dry::Initializer::Mixin` became aliases (nepalez)
|
610
|
+
|
611
|
+
[Compare v0.11.0...v1.0.0](https://github.com/dry-rb/dry-initializer/compare/v0.11.0...v1.0.0)
|
557
612
|
|
558
|
-
|
559
|
-
- Support of reloading `#initializer` with `super` (nepalez)
|
613
|
+
## 0.11.0 2017-01-02
|
560
614
|
|
561
|
-
### Internal
|
562
|
-
- Refactor the way [#initializer] method is (re)defined (nepalez)
|
563
615
|
|
564
|
-
|
565
|
-
defined not "inside" the class per se, but inside the included module. The
|
566
|
-
reference to that module is stored as class-level `__initializer_mixin__`.
|
616
|
+
### Added
|
567
617
|
|
568
|
-
|
569
|
-
It is this method to be reloaded every time you envoke a helper
|
570
|
-
`option` or `product`.
|
618
|
+
- Support of reloading `#initializer` with `super` (nepalez)
|
571
619
|
|
572
|
-
When new subclass is inherited, new mixin is added to chain of accessors,
|
573
|
-
but this time it does reload `__initialize__` only, not the `initialize`.
|
574
|
-
That is how you can safely reload initializer using `super`, but at the same
|
575
|
-
time use the whole power of dry-initializer DSL both in parent class and its
|
576
|
-
subclasses.
|
577
620
|
|
578
|
-
|
579
|
-
- Parent class mixin: `initialize` --> `__initialize__`
|
580
|
-
^
|
581
|
-
- Parent class: `initialize`
|
582
|
-
- Subclass mixin: ^ `__initialize__`
|
583
|
-
- Subclass: `initialize`
|
621
|
+
[Compare v0.10.2...v0.11.0](https://github.com/dry-rb/dry-initializer/compare/v0.10.2...v0.11.0)
|
584
622
|
|
585
|
-
|
623
|
+
## 0.10.2 2016-12-31
|
586
624
|
|
587
|
-
## [0.10.2] [2016-12-31]
|
588
625
|
|
589
626
|
### Added
|
627
|
+
|
590
628
|
- Support of Ruby 2.4 (flas-gordon)
|
591
629
|
|
592
|
-
### Internal
|
593
|
-
- Code clearance for ROM integration (flash-gordon)
|
594
630
|
|
595
|
-
|
631
|
+
[Compare v0.10.1...v0.10.2](https://github.com/dry-rb/dry-initializer/compare/v0.10.1...v0.10.2)
|
632
|
+
|
633
|
+
## 0.10.1 2016-12-27
|
634
|
+
|
596
635
|
|
597
636
|
### Fixed
|
637
|
+
|
598
638
|
- Wrong arity when there were no options and the last param had a default (nolith)
|
599
639
|
|
600
|
-
## [0.10.0] [2016-11-20]
|
601
640
|
|
602
|
-
|
603
|
-
- Deprecated method DSL#using (nepalez)
|
641
|
+
[Compare v0.10.0...v0.10.1](https://github.com/dry-rb/dry-initializer/compare/v0.10.0...v0.10.1)
|
604
642
|
|
605
|
-
##
|
643
|
+
## 0.10.0 2016-11-20
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
[Compare v0.9.3...v0.10.0](https://github.com/dry-rb/dry-initializer/compare/v0.9.3...v0.10.0)
|
648
|
+
|
649
|
+
## 0.9.3 2016-11-20
|
606
650
|
|
607
|
-
### Deprecated
|
608
|
-
- After discussion in [PR #17]: https://github.com/dry-rb/dry-initializer/pull/17)
|
609
|
-
(many thanks to @sahal2080 and @hrom512 for starting that issue and PR),
|
610
|
-
the method `using` is deprecated and will be removed from v0.10.0 (nepalez)
|
611
651
|
|
612
652
|
### Fixed
|
653
|
+
|
613
654
|
- Support of weird option names (nepalez)
|
614
655
|
|
615
656
|
```ruby
|
616
657
|
option :"First name", as: :first_name
|
617
658
|
```
|
618
659
|
|
619
|
-
|
660
|
+
|
661
|
+
[Compare v0.9.2...v0.9.3](https://github.com/dry-rb/dry-initializer/compare/v0.9.2...v0.9.3)
|
662
|
+
|
663
|
+
## 0.9.2 2016-11-10
|
664
|
+
|
620
665
|
|
621
666
|
### Fixed
|
667
|
+
|
622
668
|
- Validation of attributes (params and options) (nepalez)
|
623
669
|
|
624
|
-
|
670
|
+
|
671
|
+
[Compare v0.9.1...v0.9.2](https://github.com/dry-rb/dry-initializer/compare/v0.9.1...v0.9.2)
|
672
|
+
|
673
|
+
## 0.9.1 2016-11-06
|
674
|
+
|
625
675
|
|
626
676
|
### Added
|
677
|
+
|
627
678
|
- Support for renaming an option during initialization (nepalez)
|
628
679
|
|
629
680
|
option :name, as: :username # to take :name option and create :username attribute
|
630
681
|
|
631
|
-
|
682
|
+
|
683
|
+
[Compare v0.9.0...v0.9.1](https://github.com/dry-rb/dry-initializer/compare/v0.9.0...v0.9.1)
|
684
|
+
|
685
|
+
## 0.9.0 2016-11-06
|
686
|
+
|
632
687
|
|
633
688
|
### Added
|
689
|
+
|
634
690
|
- The method `#initialize` is defined when a class extended the module (nepalez)
|
635
691
|
|
636
692
|
In previous versions the method was defined only by `param` and `option` calls.
|
637
693
|
|
638
|
-
### Breaking Changes
|
639
|
-
- The initializer accepts any option (but skips unknown) from the very beginning (nepalez)
|
640
694
|
|
641
|
-
|
642
|
-
- Deprecated methods `tolerant_to_unknown_options` and `intolerant_to_unknown_options` (nepalez)
|
695
|
+
[Compare v0.8.1...v0.9.0](https://github.com/dry-rb/dry-initializer/compare/v0.8.1...v0.9.0)
|
643
696
|
|
644
|
-
|
645
|
-
- Refactor scope (`using`) to support methods renaming and aliasing (nepalez)
|
697
|
+
## 0.8.1 2016-11-05
|
646
698
|
|
647
|
-
## [0.8.1] [2016-11-05]
|
648
699
|
|
649
700
|
### Added
|
701
|
+
|
650
702
|
- Support for `dry-struct`ish syntax for constraints (type as a second parameter) (nepalez)
|
651
703
|
|
652
704
|
option :name, Dry::Types['strict.string']
|
653
705
|
|
654
|
-
## [0.8.0] [2016-11-05]
|
655
|
-
|
656
|
-
In this version we switched from key arguments to ** to support special keys:
|
657
706
|
|
658
|
-
|
659
|
-
option :begin
|
660
|
-
|
661
|
-
In previous versions this was translated to
|
662
|
-
|
663
|
-
def initialize(end:, begin:)
|
664
|
-
@end = end # BOOM! SyntaxError!
|
665
|
-
@begin = begin # Potential BOOM (unreached)
|
666
|
-
end
|
667
|
-
|
668
|
-
Now the assignment is imlemented like this:
|
669
|
-
|
670
|
-
def initialize(**__options__)
|
671
|
-
@end = __options__.fetch(:end)
|
672
|
-
@begin = __options__.fetch(:begin)
|
673
|
-
end
|
707
|
+
[Compare v0.8.0...v0.8.1](https://github.com/dry-rb/dry-initializer/compare/v0.8.0...v0.8.1)
|
674
708
|
|
675
|
-
|
676
|
-
to any unknown option if, and only if some `option` was set explicitly.
|
709
|
+
## 0.8.0 2016-11-05
|
677
710
|
|
678
|
-
Methods `tolerant_to_unknown_options` and `intolerant_to_unknown_options`
|
679
711
|
are deprecated and will be removed in the next version of the gem.
|
680
712
|
|
681
713
|
### Added
|
714
|
+
|
682
715
|
- support for special options like `option :end`, `option :begin` etc. (nepalez)
|
683
716
|
|
684
717
|
### Changed
|
685
|
-
- switched from key arguments to serialized hash argument in the initializer (nepalez)
|
686
718
|
|
687
|
-
|
688
|
-
- the initializer becomes tolerant to unknown options when any `option` was set,
|
689
|
-
ignoring `intolerant_to_unknown_options` helper.
|
719
|
+
- switched from key arguments to serialized hash argument in the initializer (nepalez)
|
690
720
|
|
691
|
-
-
|
692
|
-
ignoring `tolerant_to_unknown_options` helper.
|
721
|
+
[Compare v0.7.0...v0.8.0](https://github.com/dry-rb/dry-initializer/compare/v0.7.0...v0.8.0)
|
693
722
|
|
694
|
-
|
695
|
-
- `tolerant_to_unknown_options`
|
696
|
-
- `intolerant_to_unknown_options`
|
723
|
+
## 0.7.0 2016-10-11
|
697
724
|
|
698
|
-
## [0.7.0] [2016-10-11]
|
699
725
|
|
700
726
|
### Added
|
727
|
+
|
701
728
|
- Shared settings with `#using` method (nepalez)
|
702
729
|
|
703
|
-
|
730
|
+
|
731
|
+
[Compare v0.6.0...v0.7.0](https://github.com/dry-rb/dry-initializer/compare/v0.6.0...v0.7.0)
|
732
|
+
|
733
|
+
## 0.6.0 2016-10-09
|
734
|
+
|
704
735
|
|
705
736
|
### Added
|
737
|
+
|
706
738
|
- Support for private and protected readers in the `reader:` option (jmgarnier)
|
707
739
|
|
708
|
-
|
740
|
+
|
741
|
+
[Compare v0.5.0...v0.6.0](https://github.com/dry-rb/dry-initializer/compare/v0.5.0...v0.6.0)
|
742
|
+
|
743
|
+
## 0.5.0 2016-08-21
|
744
|
+
|
709
745
|
|
710
746
|
### Added
|
747
|
+
|
711
748
|
- Allow `optional` attribute to be left undefined (nepalez)
|
712
749
|
|
713
|
-
## [0.4.0] [2016-05-28]
|
714
750
|
|
715
|
-
|
716
|
-
- Support of modules and case equality as type constraints (nepalez)
|
751
|
+
[Compare v0.4.0...v0.5.0](https://github.com/dry-rb/dry-initializer/compare/v0.4.0...v0.5.0)
|
717
752
|
|
718
|
-
##
|
753
|
+
## 0.4.0 2016-05-28
|
719
754
|
|
720
|
-
- Add deprecation warnings about modules and case equality as type constraints (nepalez)
|
721
755
|
|
722
|
-
|
756
|
+
|
757
|
+
[Compare v0.3.3...v0.4.0](https://github.com/dry-rb/dry-initializer/compare/v0.3.3...v0.4.0)
|
758
|
+
|
759
|
+
## 0.3.3 2016-05-28
|
760
|
+
|
761
|
+
|
762
|
+
|
763
|
+
[Compare v0.3.2...v0.3.3](https://github.com/dry-rb/dry-initializer/compare/v0.3.2...v0.3.3)
|
764
|
+
|
765
|
+
## 0.3.2 2016-05-25
|
766
|
+
|
723
767
|
|
724
768
|
### Fixed
|
769
|
+
|
725
770
|
- Add explicit requirement for ruby 'set' (rickenharp)
|
726
771
|
|
727
|
-
## [0.3.1] [2016-05-22]
|
728
772
|
|
729
|
-
|
730
|
-
- Support for tolerance to unknown options (nepalez)
|
773
|
+
[Compare v0.3.1...v0.3.2](https://github.com/dry-rb/dry-initializer/compare/v0.3.1...v0.3.2)
|
731
774
|
|
732
|
-
##
|
775
|
+
## 0.3.1 2016-05-22
|
733
776
|
|
734
|
-
Breaks interface for adding new plugins. Register new plugin via:
|
735
777
|
|
736
|
-
|
737
|
-
def self.extended(klass)
|
738
|
-
klass.register_initializer_plugin NewPlugin
|
739
|
-
end
|
740
|
-
```
|
778
|
+
### Added
|
741
779
|
|
742
|
-
|
780
|
+
- Support for tolerance to unknown options (nepalez)
|
743
781
|
|
744
|
-
```
|
745
|
-
def self.extended(klass)
|
746
|
-
klass.initializer_builder.register NewPlugin
|
747
|
-
end
|
748
|
-
```
|
749
782
|
|
750
|
-
|
751
|
-
its method #register doesn't mutate the builder instance.
|
783
|
+
[Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-initializer/compare/v0.3.0...v0.3.1)
|
752
784
|
|
753
|
-
|
754
|
-
|
755
|
-
|
785
|
+
## 0.3.0 2016-05-19
|
786
|
+
|
787
|
+
its method #register doesn't mutate the builder instance.
|
756
788
|
|
757
789
|
### Fixed
|
790
|
+
|
758
791
|
- Prevent plugin's registry from polluting superclass (nepalez)
|
759
792
|
|
760
793
|
### Changed
|
794
|
+
|
795
|
+
- Made Mixin##initializer_builder method private (nepalez)
|
796
|
+
- Add Mixin#register_initializer_plugin(plugin) method (nepalez)
|
761
797
|
- Make all instances (Builder and Signature) immutable (nepalez)
|
762
798
|
- Decouple mixin from a builder to prevent pollution (nepalez)
|
763
799
|
- Ensure default value block can use private variables (jeremyf)
|
764
800
|
|
765
|
-
|
801
|
+
[Compare v0.2.1...v0.3.0](https://github.com/dry-rb/dry-initializer/compare/v0.2.1...v0.3.0)
|
802
|
+
|
803
|
+
## 0.2.1 2016-05-19
|
804
|
+
|
766
805
|
|
767
806
|
### Fixed
|
807
|
+
|
768
808
|
- Fix polluting superclass with declarations from subclass (nepalez)
|
769
809
|
|
770
810
|
### Changed
|
811
|
+
|
771
812
|
- Make all instances (Builder and Signature) immutable (nepalez)
|
772
813
|
- Decouple mixin from a builder to prevent pollution (nepalez)
|
773
814
|
- Ensure default value block can use private variables (jeremyf)
|
774
815
|
|
775
|
-
|
776
|
-
|
777
|
-
The gem internals has been rewritten heavily to make the gem pluggable and fix
|
778
|
-
bugs in "container style". Type constraints were extracted to a plugin
|
779
|
-
that should be added explicitly.
|
816
|
+
[Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-initializer/compare/v0.2.0...v0.2.1)
|
780
817
|
|
781
|
-
|
782
|
-
object, and apply value coercion via `dry-types`.
|
818
|
+
## 0.2.0 2016-05-16
|
783
819
|
|
784
820
|
Default assignments became slower (while plain type constraint are not)!
|
785
821
|
|
786
|
-
###
|
822
|
+
### Added
|
823
|
+
|
824
|
+
- Support type constraint via every object's case equality (nepalez)
|
825
|
+
|
826
|
+
```ruby
|
827
|
+
option :name, type: /foo/
|
828
|
+
option :name, type: (1...14)
|
829
|
+
```
|
830
|
+
- Support defaults and type constraints for the "container" syntax (nepalez)
|
831
|
+
- Support adding extensions via plugin system (nepalez)
|
832
|
+
|
833
|
+
### Changed
|
834
|
+
|
787
835
|
- Make dry-types constraint to coerce variables (nepalez)
|
788
836
|
|
789
837
|
```ruby
|
790
838
|
# This will coerce `name: :foo` to `"foo"`
|
791
839
|
option :name, type: Dry::Types::Coercible::String
|
792
840
|
```
|
793
|
-
|
794
841
|
- Stop supporing proc type constraint (nepalez)
|
795
842
|
|
796
843
|
```ruby
|
@@ -810,87 +857,32 @@ Default assignments became slower (while plain type constraint are not)!
|
|
810
857
|
end
|
811
858
|
```
|
812
859
|
|
813
|
-
|
814
|
-
- Support type constraint via every object's case equality (nepalez)
|
860
|
+
[Compare v0.1.1...v0.2.0](https://github.com/dry-rb/dry-initializer/compare/v0.1.1...v0.2.0)
|
815
861
|
|
816
|
-
|
817
|
-
option :name, type: /foo/
|
818
|
-
option :name, type: (1...14)
|
819
|
-
```
|
862
|
+
## 0.1.1 2016-04-28
|
820
863
|
|
821
|
-
- Support defaults and type constraints for the "container" syntax (nepalez)
|
822
|
-
- Support adding extensions via plugin system (nepalez)
|
823
864
|
|
824
|
-
###
|
825
|
-
|
865
|
+
### Added
|
866
|
+
|
867
|
+
- `include Dry::Initializer.define -> do ... end` syntax (flash-gordon)
|
826
868
|
|
827
|
-
The previous implementation required defaults and types to be stored in the class method `.initializer_builder`.
|
828
|
-
That made "container" syntax to support neither defaults nor types.
|
829
869
|
|
830
|
-
|
831
|
-
(like default assignments, coercions, dry-type constraints etc.) cannot be implemented in this way.
|
832
|
-
They are made inside `##__after_initialize__` callback, that is biult via `default_method(&block)`
|
833
|
-
using instance evals.
|
870
|
+
[Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-initializer/compare/v0.1.0...v0.1.1)
|
834
871
|
|
835
|
-
##
|
872
|
+
## 0.1.0 2016-04-26
|
873
|
+
|
874
|
+
Backward compatibility is broken.
|
836
875
|
|
837
876
|
### Added
|
838
|
-
- `include Dry::Initializer.define -> do ... end` syntax (flash-gordon)
|
839
877
|
|
840
|
-
|
878
|
+
- Use `include Dry::Initializer.define(&block)` as an alternative to extending the class (nepalez)
|
841
879
|
|
842
|
-
|
843
|
-
Backward compatibility is broken.
|
880
|
+
### Changed
|
844
881
|
|
845
|
-
### Changed (backward-incompatible changes)
|
846
882
|
- Use `extend Dry::Initializer::Mixin` instead of `extend Dry::Initializer` (nepalez)
|
847
883
|
|
848
|
-
|
849
|
-
- Use `include Dry::Initializer.define(&block)` as an alternative to extending the class (nepalez)
|
884
|
+
[Compare v0.0.1...v0.1.0](https://github.com/dry-rb/dry-initializer/compare/v0.0.1...v0.1.0)
|
850
885
|
|
851
|
-
##
|
886
|
+
## 0.0.1 2016-04-09
|
852
887
|
|
853
888
|
First public release
|
854
|
-
|
855
|
-
[0.1.0]: https://github.com/dry-rb/dry-initializer/compare/v0.0.1...v0.1.0
|
856
|
-
[0.1.1]: https://github.com/dry-rb/dry-initializer/compare/v0.1.0...v0.1.1
|
857
|
-
[0.2.0]: https://github.com/dry-rb/dry-initializer/compare/v0.1.1...v0.2.0
|
858
|
-
[0.2.1]: https://github.com/dry-rb/dry-initializer/compare/v0.2.0...v0.2.1
|
859
|
-
[0.2.1]: https://github.com/dry-rb/dry-initializer/compare/v0.2.0...v0.2.1
|
860
|
-
[0.3.0]: https://github.com/dry-rb/dry-initializer/compare/v0.2.1...v0.3.0
|
861
|
-
[0.3.1]: https://github.com/dry-rb/dry-initializer/compare/v0.3.0...v0.3.1
|
862
|
-
[0.3.2]: https://github.com/dry-rb/dry-initializer/compare/v0.3.1...v0.3.2
|
863
|
-
[0.3.3]: https://github.com/dry-rb/dry-initializer/compare/v0.3.2...v0.3.3
|
864
|
-
[0.4.0]: https://github.com/dry-rb/dry-initializer/compare/v0.3.3...v0.4.0
|
865
|
-
[0.5.0]: https://github.com/dry-rb/dry-initializer/compare/v0.4.0...v0.5.0
|
866
|
-
[0.6.0]: https://github.com/dry-rb/dry-initializer/compare/v0.5.0...v0.6.0
|
867
|
-
[0.7.0]: https://github.com/dry-rb/dry-initializer/compare/v0.6.0...v0.7.0
|
868
|
-
[0.8.0]: https://github.com/dry-rb/dry-initializer/compare/v0.7.0...v0.8.0
|
869
|
-
[0.8.1]: https://github.com/dry-rb/dry-initializer/compare/v0.8.0...v0.8.1
|
870
|
-
[0.9.0]: https://github.com/dry-rb/dry-initializer/compare/v0.8.1...v0.9.0
|
871
|
-
[0.9.1]: https://github.com/dry-rb/dry-initializer/compare/v0.9.0...v0.9.1
|
872
|
-
[0.9.2]: https://github.com/dry-rb/dry-initializer/compare/v0.9.1...v0.9.2
|
873
|
-
[0.9.3]: https://github.com/dry-rb/dry-initializer/compare/v0.9.2...v0.9.3
|
874
|
-
[0.10.0]: https://github.com/dry-rb/dry-initializer/compare/v0.9.3...v0.10.0
|
875
|
-
[0.10.1]: https://github.com/dry-rb/dry-initializer/compare/v0.10.0...v0.10.1
|
876
|
-
[0.10.2]: https://github.com/dry-rb/dry-initializer/compare/v0.10.1...v0.10.2
|
877
|
-
[0.11.0]: https://github.com/dry-rb/dry-initializer/compare/v0.10.2...v0.11.0
|
878
|
-
[1.0.0]: https://github.com/dry-rb/dry-initializer/compare/v0.11.0...v1.0.0
|
879
|
-
[1.1.0]: https://github.com/dry-rb/dry-initializer/compare/v1.0.0...v1.1.0
|
880
|
-
[1.1.1]: https://github.com/dry-rb/dry-initializer/compare/v1.1.0...v1.1.1
|
881
|
-
[1.1.2]: https://github.com/dry-rb/dry-initializer/compare/v1.1.1...v1.1.2
|
882
|
-
[1.1.3]: https://github.com/dry-rb/dry-initializer/compare/v1.1.2...v1.1.3
|
883
|
-
[1.2.0]: https://github.com/dry-rb/dry-initializer/compare/v1.1.3...v1.2.0
|
884
|
-
[1.3.0]: https://github.com/dry-rb/dry-initializer/compare/v1.2.0...v1.3.0
|
885
|
-
[1.4.0]: https://github.com/dry-rb/dry-initializer/compare/v1.3.0...v1.4.0
|
886
|
-
[1.4.1]: https://github.com/dry-rb/dry-initializer/compare/v1.4.0...v1.4.1
|
887
|
-
[2.0.0]: https://github.com/dry-rb/dry-initializer/compare/v1.4.1...v2.0.0
|
888
|
-
[2.1.0]: https://github.com/dry-rb/dry-initializer/compare/v2.0.0...v2.1.0
|
889
|
-
[2.2.0]: https://github.com/dry-rb/dry-initializer/compare/v2.1.0...v2.2.0
|
890
|
-
[2.3.0]: https://github.com/dry-rb/dry-initializer/compare/v2.2.0...v2.3.0
|
891
|
-
[2.4.0]: https://github.com/dry-rb/dry-initializer/compare/v2.3.0...v2.4.0
|
892
|
-
[2.6.0]: https://github.com/dry-rb/dry-initializer/compare/v2.4.0...v2.5.0
|
893
|
-
[2.6.0]: https://github.com/dry-rb/dry-initializer/compare/v2.5.0...v2.6.0
|
894
|
-
[3.0.0]: https://github.com/dry-rb/dry-initializer/compare/v2.5.0...v3.0.0
|
895
|
-
[3.0.1]: https://github.com/dry-rb/dry-initializer/compare/v3.0.0...v3.0.1
|
896
|
-
[3.0.2]: https://github.com/dry-rb/dry-initializer/compare/v3.0.1...v3.0.2
|