dry-initializer 0.11.0 → 1.1.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 +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -61
- data/.travis.yml +18 -11
- data/CHANGELOG.md +108 -43
- data/Gemfile +1 -0
- data/Rakefile +6 -0
- data/benchmarks/options.rb +4 -4
- data/benchmarks/params.rb +1 -1
- data/benchmarks/profiler.rb +28 -0
- data/benchmarks/with_types.rb +5 -9
- data/benchmarks/with_types_and_defaults.rb +2 -4
- data/benchmarks/without_options.rb +3 -3
- data/dry-initializer.gemspec +1 -1
- data/lib/dry/initializer/attribute.rb +92 -0
- data/lib/dry/initializer/builder.rb +76 -72
- data/lib/dry/initializer/exceptions/default_value_error.rb +8 -0
- data/lib/dry/initializer/exceptions/params_order_error.rb +8 -0
- data/lib/dry/initializer/exceptions/type_constraint_error.rb +7 -0
- data/lib/dry/initializer/option.rb +62 -0
- data/lib/dry/initializer/param.rb +54 -0
- data/lib/dry/initializer.rb +77 -13
- data/spec/enhancement_spec.rb +18 -0
- data/spec/missed_default_spec.rb +2 -2
- data/spec/optional_spec.rb +16 -6
- data/spec/options_var_spec.rb +39 -0
- data/spec/repetitive_definitions_spec.rb +38 -18
- data/spec/several_assignments_spec.rb +41 -0
- data/spec/type_constraint_spec.rb +6 -5
- metadata +15 -20
- data/lib/dry/initializer/errors/default_value_error.rb +0 -6
- data/lib/dry/initializer/errors/order_error.rb +0 -7
- data/lib/dry/initializer/errors/plugin_error.rb +0 -6
- data/lib/dry/initializer/errors/redefinition_error.rb +0 -5
- data/lib/dry/initializer/errors/type_constraint_error.rb +0 -5
- data/lib/dry/initializer/errors.rb +0 -10
- data/lib/dry/initializer/mixin.rb +0 -77
- data/lib/dry/initializer/plugins/base.rb +0 -47
- data/lib/dry/initializer/plugins/default_proc.rb +0 -28
- data/lib/dry/initializer/plugins/signature.rb +0 -28
- data/lib/dry/initializer/plugins/type_constraint.rb +0 -21
- data/lib/dry/initializer/plugins/variable_setter.rb +0 -30
- data/lib/dry/initializer/plugins.rb +0 -10
- data/lib/dry/initializer/signature.rb +0 -61
- data/spec/plugin_registry_spec.rb +0 -45
- data/spec/renaming_options_spec.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 852519c02a938d27a827cff9c4cfd1e40c9c9dac
|
4
|
+
data.tar.gz: 94923136d38c0afbc74ffa76ed35c4074c9ba75b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4195fe8176762d89b1593f05cde79e4c249dda71ace60fb070a75f92222f344d349cc97b3567e032d3aa67ac4556e97bc4282133fac724ea655decc1a4e95e7
|
7
|
+
data.tar.gz: 0d50b2012d31467424ff6c232c5c3d8fff0e5d601eacf533c23f080933205aaa384948b98cc0831496ec6ac30b38697bf99554ef8d79b3f04f0922ef10de0b7e
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -5,62 +5,24 @@ AllCops:
|
|
5
5
|
StyleGuideCopsOnly: true
|
6
6
|
TargetRubyVersion: 2.2
|
7
7
|
|
8
|
-
Lint/HandleExceptions:
|
9
|
-
Exclude:
|
10
|
-
- spec/**/*_spec.rb
|
11
|
-
|
12
|
-
Lint/RescueException:
|
13
|
-
Exclude:
|
14
|
-
- spec/**/*_spec.rb
|
15
|
-
|
16
|
-
Metrics/LineLength:
|
17
|
-
Max: 80
|
18
|
-
Exclude:
|
19
|
-
- spec/**/*_spec.rb
|
20
|
-
|
21
|
-
Style/AccessorMethodName:
|
22
|
-
Exclude:
|
23
|
-
- spec/**/*_spec.rb
|
24
|
-
|
25
|
-
Style/Alias:
|
26
|
-
EnforcedStyle: prefer_alias_method
|
27
|
-
|
28
|
-
Style/AsciiComments:
|
29
|
-
Enabled: false
|
30
|
-
|
31
|
-
Style/BlockDelimiters:
|
32
|
-
Exclude:
|
33
|
-
- spec/**/*_spec.rb
|
34
|
-
|
35
8
|
Style/CaseEquality:
|
36
9
|
Enabled: false
|
37
10
|
|
38
|
-
Style/
|
39
|
-
Enabled: false
|
40
|
-
|
41
|
-
Style/Documentation:
|
11
|
+
Style/ClassVars:
|
42
12
|
Enabled: false
|
43
13
|
|
44
14
|
Style/DoubleNegation:
|
45
15
|
Enabled: false
|
46
16
|
|
47
|
-
Style/EmptyLinesAroundClassBody:
|
48
|
-
Enabled: false
|
49
|
-
|
50
|
-
Style/EmptyLinesAroundModuleBody:
|
51
|
-
Enabled: false
|
52
|
-
|
53
|
-
Style/EmptyLineBetweenDefs:
|
54
|
-
Enabled: false
|
55
|
-
|
56
17
|
Style/FileName:
|
57
|
-
|
18
|
+
Exclude:
|
19
|
+
- lib/dry-initializer.rb
|
58
20
|
|
59
21
|
Style/Lambda:
|
60
22
|
Exclude:
|
61
23
|
- spec/**/*_spec.rb
|
62
24
|
|
63
|
-
Style/
|
25
|
+
Style/LambdaCall:
|
64
26
|
Enabled: false
|
65
27
|
|
66
28
|
Style/RaiseArgs:
|
@@ -73,27 +35,8 @@ Style/Semicolon:
|
|
73
35
|
Style/SignalException:
|
74
36
|
EnforcedStyle: semantic
|
75
37
|
|
76
|
-
Style/SingleLineBlockParams:
|
77
|
-
Enabled: false
|
78
|
-
|
79
|
-
Style/SingleLineMethods:
|
80
|
-
Exclude:
|
81
|
-
- spec/**/*_spec.rb
|
82
|
-
|
83
|
-
Style/SpaceBeforeFirstArg:
|
84
|
-
Enabled: false
|
85
|
-
|
86
|
-
Style/SpecialGlobalVars:
|
87
|
-
Exclude:
|
88
|
-
- Gemfile
|
89
|
-
- dry-initializer.gemspec
|
90
|
-
|
91
38
|
Style/StringLiterals:
|
92
39
|
EnforcedStyle: double_quotes
|
93
40
|
|
94
41
|
Style/StringLiteralsInInterpolation:
|
95
42
|
EnforcedStyle: double_quotes
|
96
|
-
|
97
|
-
Style/TrivialAccessors:
|
98
|
-
Exclude:
|
99
|
-
- spec/**/*_spec.rb
|
data/.travis.yml
CHANGED
@@ -1,20 +1,27 @@
|
|
1
1
|
---
|
2
|
-
sudo: false
|
3
2
|
language: ruby
|
4
|
-
|
3
|
+
sudo: false
|
4
|
+
cache: bundler
|
5
|
+
bundler_args: --without benchmarks tools
|
5
6
|
script:
|
6
|
-
- bundle exec
|
7
|
-
- bundle exec rubocop
|
7
|
+
- bundle exec rake spec
|
8
8
|
rvm:
|
9
|
-
-
|
10
|
-
-
|
11
|
-
-
|
12
|
-
|
9
|
+
- 2.2
|
10
|
+
- 2.3.0
|
11
|
+
- 2.4.0
|
12
|
+
- jruby-9000
|
13
|
+
- rbx-2
|
14
|
+
- rbx-3
|
13
15
|
- ruby-head
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
env:
|
17
|
+
global:
|
18
|
+
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
17
19
|
matrix:
|
18
20
|
allow_failures:
|
21
|
+
- rvm: rbx-2
|
22
|
+
- rvm: rbx-3
|
19
23
|
- rvm: ruby-head
|
20
24
|
- rvm: jruby-head
|
25
|
+
include:
|
26
|
+
- rvm: jruby-head
|
27
|
+
before_install: gem install bundler --no-ri --no-rdoc
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,77 @@
|
|
1
|
+
## v1.1.0 2017-01-28
|
2
|
+
|
3
|
+
# Added:
|
4
|
+
- enhancement via `Dry::Initializer::Attribute.dispatchers` registry (nepalez)
|
5
|
+
|
6
|
+
# Register dispatcher for `:string` option
|
7
|
+
Dry::Initializer::Attribute.dispatchers << ->(string: nil, **op) do
|
8
|
+
string ? op.merge(type: proc(&:to_s)) : op
|
9
|
+
end
|
10
|
+
|
11
|
+
# Now you can use the `:string` key for `param` and `option`
|
12
|
+
class User
|
13
|
+
extend Dry::Initializer
|
14
|
+
param :name, string: true
|
15
|
+
end
|
16
|
+
|
17
|
+
User.new(:Andy).name # => "Andy"
|
18
|
+
|
19
|
+
# Internals:
|
20
|
+
- optimize assignments for performance (nepalez)
|
21
|
+
|
22
|
+
[Compare v1.0.0...v1.1.0](https://github.com/dry-rb/dry-initializer/compare/v1.0.0...v1.1.0)
|
23
|
+
|
24
|
+
## v1.0.0 2017-01-22
|
25
|
+
|
26
|
+
In this version the code has been rewritten for simplicity
|
27
|
+
|
28
|
+
# BREAKING CHANGES
|
29
|
+
- 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)
|
30
|
+
|
31
|
+
# Added:
|
32
|
+
- support for reloading `param` and `option` definitions (nepalez)
|
33
|
+
|
34
|
+
class User
|
35
|
+
extend Dry::Initializer
|
36
|
+
param :name
|
37
|
+
param :phone, optional: true
|
38
|
+
end
|
39
|
+
|
40
|
+
User.new # => Boom!
|
41
|
+
|
42
|
+
class Admin < User
|
43
|
+
param :name, default: proc { 'Merlin' }
|
44
|
+
end
|
45
|
+
|
46
|
+
# order of the param not changed
|
47
|
+
Admin.new.name # => "Merlin"
|
48
|
+
|
49
|
+
- support for assignment of attributes via several options (nepalez)
|
50
|
+
|
51
|
+
class User
|
52
|
+
extend Dry::Initializer
|
53
|
+
option :phone
|
54
|
+
option :number, as: :phone
|
55
|
+
end
|
56
|
+
|
57
|
+
# Both ways provide the same result
|
58
|
+
User.new(phone: '1234567890').phone # => '1234567890'
|
59
|
+
User.new(number: '1234567890').phone # => '1234567890'
|
60
|
+
|
61
|
+
# Internals
|
62
|
+
- `Dry::Initializer` and `Dry::Initializer::Mixin` became aliases (nepalez)
|
63
|
+
|
64
|
+
[Compare v0.11.0...v1.0.0](https://github.com/dry-rb/dry-initializer/compare/v0.11.0...v1.0.0)
|
65
|
+
|
1
66
|
## v0.11.0 2017-01-02
|
2
67
|
|
3
68
|
### Added
|
4
69
|
|
5
|
-
* Support of reloading `#initializer` with `super` (
|
70
|
+
* Support of reloading `#initializer` with `super` (nepalez)
|
6
71
|
|
7
72
|
### Internal
|
8
73
|
|
9
|
-
* Refactor the way [#initializer] method is (re)defined (
|
74
|
+
* Refactor the way [#initializer] method is (re)defined (nepalez)
|
10
75
|
|
11
76
|
When you extend class with `Dry::Initializer::Mixin`, the initializer is
|
12
77
|
defined not "inside" the class per se, but inside the included module. The
|
@@ -37,11 +102,11 @@
|
|
37
102
|
|
38
103
|
### Added
|
39
104
|
|
40
|
-
* Support of Ruby 2.4 (
|
105
|
+
* Support of Ruby 2.4 (flas-gordon)
|
41
106
|
|
42
107
|
### Internal
|
43
108
|
|
44
|
-
* Code clearance for ROM integration (
|
109
|
+
* Code clearance for ROM integration (flash-gordon)
|
45
110
|
|
46
111
|
[Compare v0.10.1...v0.10.2](https://github.com/dry-rb/dry-initializer/compare/v0.10.1...v0.10.2)
|
47
112
|
|
@@ -49,7 +114,7 @@
|
|
49
114
|
|
50
115
|
### Fixed
|
51
116
|
|
52
|
-
* Wrong arity when there were no options and the last param had a default (
|
117
|
+
* Wrong arity when there were no options and the last param had a default (nolith)
|
53
118
|
|
54
119
|
[Compare v0.10.0...v0.10.1](https://github.com/dry-rb/dry-initializer/compare/v0.10.0...v0.10.1)
|
55
120
|
|
@@ -57,7 +122,7 @@
|
|
57
122
|
|
58
123
|
### Deleted (BREAKING CHANGE!)
|
59
124
|
|
60
|
-
* Deprecated method DSL#using (
|
125
|
+
* Deprecated method DSL#using (nepalez)
|
61
126
|
|
62
127
|
[Compare v0.9.3...v0.10.0](https://github.com/dry-rb/dry-initializer/compare/v0.9.3...v0.10.0)
|
63
128
|
|
@@ -67,11 +132,11 @@
|
|
67
132
|
|
68
133
|
* After discussion in [PR #17](https://github.com/dry-rb/dry-initializer/pull/17)
|
69
134
|
(many thanks to @sahal2080 and @hrom512 for starting that issue and PR),
|
70
|
-
the method `using` is deprecated and will be removed from v0.10.0 (
|
135
|
+
the method `using` is deprecated and will be removed from v0.10.0 (nepalez)
|
71
136
|
|
72
137
|
### Fixed
|
73
138
|
|
74
|
-
* Support of weird option names (
|
139
|
+
* Support of weird option names (nepalez)
|
75
140
|
|
76
141
|
```ruby
|
77
142
|
option :"First name", as: :first_name
|
@@ -83,7 +148,7 @@
|
|
83
148
|
|
84
149
|
### Fixed
|
85
150
|
|
86
|
-
* Validation of attributes (params and options) (
|
151
|
+
* Validation of attributes (params and options) (nepalez)
|
87
152
|
|
88
153
|
[Compare v0.9.1...v0.9.2](https://github.com/dry-rb/dry-initializer/compare/v0.9.1...v0.9.2)
|
89
154
|
|
@@ -91,7 +156,7 @@
|
|
91
156
|
|
92
157
|
### Added
|
93
158
|
|
94
|
-
* Support for renaming an option during initialization (
|
159
|
+
* Support for renaming an option during initialization (nepalez)
|
95
160
|
|
96
161
|
option :name, as: :username # to take :name option and create :username attribute
|
97
162
|
|
@@ -101,21 +166,21 @@
|
|
101
166
|
|
102
167
|
### Added
|
103
168
|
|
104
|
-
* The method `#initialize` is defined when a class extended the module (
|
169
|
+
* The method `#initialize` is defined when a class extended the module (nepalez)
|
105
170
|
|
106
171
|
In previous versions the method was defined only by `param` and `option` calls.
|
107
172
|
|
108
173
|
### Breaking Changes
|
109
174
|
|
110
|
-
* The initializer accepts any option (but skips unknown) from the very beginning (
|
175
|
+
* The initializer accepts any option (but skips unknown) from the very beginning (nepalez)
|
111
176
|
|
112
177
|
### Deleted
|
113
178
|
|
114
|
-
* Deprecated methods `tolerant_to_unknown_options` and `intolerant_to_unknown_options` (
|
179
|
+
* Deprecated methods `tolerant_to_unknown_options` and `intolerant_to_unknown_options` (nepalez)
|
115
180
|
|
116
181
|
### Internal
|
117
182
|
|
118
|
-
* Refactor scope (`using`) to support methods renaming and aliasing (
|
183
|
+
* Refactor scope (`using`) to support methods renaming and aliasing (nepalez)
|
119
184
|
|
120
185
|
[Compare v0.8.1...v0.9.0](https://github.com/dry-rb/dry-initializer/compare/v0.8.1...v0.9.0)
|
121
186
|
|
@@ -123,7 +188,7 @@
|
|
123
188
|
|
124
189
|
### Added
|
125
190
|
|
126
|
-
* Support for `dry-struct`ish syntax for constraints (type as a second parameter) (
|
191
|
+
* Support for `dry-struct`ish syntax for constraints (type as a second parameter) (nepalez)
|
127
192
|
|
128
193
|
option :name, Dry::Types['strict.string']
|
129
194
|
|
@@ -158,11 +223,11 @@ are deprecated and will be removed in the next version of the gem.
|
|
158
223
|
|
159
224
|
### Added
|
160
225
|
|
161
|
-
* support for special options like `option :end`, `option :begin` etc. (
|
226
|
+
* support for special options like `option :end`, `option :begin` etc. (nepalez)
|
162
227
|
|
163
228
|
### Internals
|
164
229
|
|
165
|
-
* switched from key arguments to serialized hash argument in the initializer (
|
230
|
+
* switched from key arguments to serialized hash argument in the initializer (nepalez)
|
166
231
|
|
167
232
|
### Breaking Changes
|
168
233
|
|
@@ -183,7 +248,7 @@ are deprecated and will be removed in the next version of the gem.
|
|
183
248
|
|
184
249
|
### Added
|
185
250
|
|
186
|
-
* Shared settings with `#using` method (
|
251
|
+
* Shared settings with `#using` method (nepalez)
|
187
252
|
|
188
253
|
[Compare v0.6.0...v0.7.0](https://github.com/dry-rb/dry-initializer/compare/v0.6.0...v0.7.0)
|
189
254
|
|
@@ -191,7 +256,7 @@ are deprecated and will be removed in the next version of the gem.
|
|
191
256
|
|
192
257
|
### Added
|
193
258
|
|
194
|
-
* Support for private and protected readers in the `reader:` option (
|
259
|
+
* Support for private and protected readers in the `reader:` option (jmgarnier)
|
195
260
|
|
196
261
|
[Compare v0.5.0...v0.6.0](https://github.com/dry-rb/dry-initializer/compare/v0.5.0...v0.6.0)
|
197
262
|
|
@@ -199,7 +264,7 @@ are deprecated and will be removed in the next version of the gem.
|
|
199
264
|
|
200
265
|
### Added
|
201
266
|
|
202
|
-
* Allow `optional` attribute to be left undefined (
|
267
|
+
* Allow `optional` attribute to be left undefined (nepalez)
|
203
268
|
|
204
269
|
[Compare v0.4.0...v0.5.0](https://github.com/dry-rb/dry-initializer/compare/v0.4.0...v0.5.0)
|
205
270
|
|
@@ -207,13 +272,13 @@ are deprecated and will be removed in the next version of the gem.
|
|
207
272
|
|
208
273
|
### Deleted (backward-incompatible changes)
|
209
274
|
|
210
|
-
* Support of modules and case equality as type constraints (
|
275
|
+
* Support of modules and case equality as type constraints (nepalez)
|
211
276
|
|
212
277
|
[Compare v0.3.3...v0.4.0](https://github.com/dry-rb/dry-initializer/compare/v0.3.3...v0.4.0)
|
213
278
|
|
214
279
|
## v0.3.3 2016-05-28
|
215
280
|
|
216
|
-
* Add deprecation warnings about modules and case equality as type constraints (
|
281
|
+
* Add deprecation warnings about modules and case equality as type constraints (nepalez)
|
217
282
|
|
218
283
|
[Compare v0.3.2...v0.3.3](https://github.com/dry-rb/dry-initializer/compare/v0.3.2...v0.3.3)
|
219
284
|
|
@@ -221,7 +286,7 @@ are deprecated and will be removed in the next version of the gem.
|
|
221
286
|
|
222
287
|
### Bugs Fixed
|
223
288
|
|
224
|
-
* Add explicit requirement for ruby 'set' (
|
289
|
+
* Add explicit requirement for ruby 'set' (rickenharp)
|
225
290
|
|
226
291
|
[Compare v0.3.1...v0.3.2](https://github.com/dry-rb/dry-initializer/compare/v0.3.1...v0.3.2)
|
227
292
|
|
@@ -229,7 +294,7 @@ are deprecated and will be removed in the next version of the gem.
|
|
229
294
|
|
230
295
|
### Added
|
231
296
|
|
232
|
-
* Support for tolerance to unknown options (
|
297
|
+
* Support for tolerance to unknown options (nepalez)
|
233
298
|
|
234
299
|
[Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-initializer/compare/v0.3.0...v0.3.1)
|
235
300
|
|
@@ -256,20 +321,20 @@ its method #register doesn't mutate the builder instance.
|
|
256
321
|
|
257
322
|
### Changed (backward-incompatible changes)
|
258
323
|
|
259
|
-
* Made Mixin##initializer_builder method private (
|
260
|
-
* Add Mixin#register_initializer_plugin(plugin) method (
|
324
|
+
* Made Mixin##initializer_builder method private (nepalez)
|
325
|
+
* Add Mixin#register_initializer_plugin(plugin) method (nepalez)
|
261
326
|
|
262
327
|
### Bugs Fixed
|
263
328
|
|
264
|
-
* Prevent plugin's registry from polluting superclass (
|
329
|
+
* Prevent plugin's registry from polluting superclass (nepalez)
|
265
330
|
|
266
331
|
[Compare v0.2.1...v0.3.0](https://github.com/dry-rb/dry-initializer/compare/v0.2.1...v0.3.0)
|
267
332
|
|
268
333
|
### Internals
|
269
334
|
|
270
|
-
* Make all instances (Builder and Signature) immutable (
|
271
|
-
* Decouple mixin from a builder to prevent pollution (
|
272
|
-
* Ensure default value block can use private variables (
|
335
|
+
* Make all instances (Builder and Signature) immutable (nepalez)
|
336
|
+
* Decouple mixin from a builder to prevent pollution (nepalez)
|
337
|
+
* Ensure default value block can use private variables (jeremyf)
|
273
338
|
|
274
339
|
[Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-initializer/compare/v0.2.0...v0.2.1)
|
275
340
|
|
@@ -277,13 +342,13 @@ its method #register doesn't mutate the builder instance.
|
|
277
342
|
|
278
343
|
### Bugs Fixed
|
279
344
|
|
280
|
-
* Fix polluting superclass with declarations from subclass (
|
345
|
+
* Fix polluting superclass with declarations from subclass (nepalez)
|
281
346
|
|
282
347
|
### Internals
|
283
348
|
|
284
|
-
* Make all instances (Builder and Signature) immutable (
|
285
|
-
* Decouple mixin from a builder to prevent pollution (
|
286
|
-
* Ensure default value block can use private variables (
|
349
|
+
* Make all instances (Builder and Signature) immutable (nepalez)
|
350
|
+
* Decouple mixin from a builder to prevent pollution (nepalez)
|
351
|
+
* Ensure default value block can use private variables (jeremyf)
|
287
352
|
|
288
353
|
[Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-initializer/compare/v0.2.0...v0.2.1)
|
289
354
|
|
@@ -300,14 +365,14 @@ Default assignments became slower (while plain type constraint are not)!
|
|
300
365
|
|
301
366
|
### Changed (backward-incompatible changes)
|
302
367
|
|
303
|
-
* Make dry-types constraint to coerce variables (
|
368
|
+
* Make dry-types constraint to coerce variables (nepalez)
|
304
369
|
|
305
370
|
```ruby
|
306
371
|
# This will coerce `name: :foo` to `"foo"`
|
307
372
|
option :name, type: Dry::Types::Coercible::String
|
308
373
|
```
|
309
374
|
|
310
|
-
* Stop supporing proc type constraint (
|
375
|
+
* Stop supporing proc type constraint (nepalez)
|
311
376
|
|
312
377
|
```ruby
|
313
378
|
option :name, type: ->(v) { String === v } # this does NOT work any more
|
@@ -328,19 +393,19 @@ Default assignments became slower (while plain type constraint are not)!
|
|
328
393
|
|
329
394
|
### Added
|
330
395
|
|
331
|
-
* Support type constraint via every object's case equality (
|
396
|
+
* Support type constraint via every object's case equality (nepalez)
|
332
397
|
|
333
398
|
```ruby
|
334
399
|
option :name, type: /foo/
|
335
400
|
option :name, type: (1...14)
|
336
401
|
```
|
337
402
|
|
338
|
-
* Support defaults and type constraints for the "container" syntax (
|
339
|
-
* Support adding extensions via plugin system (
|
403
|
+
* Support defaults and type constraints for the "container" syntax (nepalez)
|
404
|
+
* Support adding extensions via plugin system (nepalez)
|
340
405
|
|
341
406
|
### Internal
|
342
407
|
|
343
|
-
* Private method `##__after_initialize__` is added by the `Mixin` along with `#initialize` (
|
408
|
+
* Private method `##__after_initialize__` is added by the `Mixin` along with `#initialize` (nepalez)
|
344
409
|
|
345
410
|
The previous implementation required defaults and types to be stored in the class method `.initializer_builder`.
|
346
411
|
That made "container" syntax to support neither defaults nor types.
|
@@ -356,7 +421,7 @@ Default assignments became slower (while plain type constraint are not)!
|
|
356
421
|
|
357
422
|
### Added
|
358
423
|
|
359
|
-
* `include Dry::Initializer.define -> do ... end` syntax (
|
424
|
+
* `include Dry::Initializer.define -> do ... end` syntax (flash-gordon)
|
360
425
|
|
361
426
|
[Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-initializer/compare/v0.1.0...v0.1.1)
|
362
427
|
|
@@ -367,11 +432,11 @@ Backward compatibility is broken.
|
|
367
432
|
|
368
433
|
### Changed (backward-incompatible changes)
|
369
434
|
|
370
|
-
* Use `extend Dry::Initializer::Mixin` instead of `extend Dry::Initializer` (
|
435
|
+
* Use `extend Dry::Initializer::Mixin` instead of `extend Dry::Initializer` (nepalez)
|
371
436
|
|
372
437
|
### Added
|
373
438
|
|
374
|
-
* Use `include Dry::Initializer.define(&block)` as an alternative to extending the class (
|
439
|
+
* Use `include Dry::Initializer.define(&block)` as an alternative to extending the class (nepalez)
|
375
440
|
|
376
441
|
[Compare v0.0.1...v0.1.0](https://github.com/dry-rb/dry-initializer/compare/v0.0.1...v0.1.0)
|
377
442
|
|