dry-initializer 0.9.1 → 0.9.2
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/CHANGELOG.md +22 -14
- data/dry-initializer.gemspec +1 -1
- data/lib/dry/initializer/signature.rb +21 -5
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 18ddd83e225177df21ed6dda7229643f2a746b3e
|
|
4
|
+
data.tar.gz: 58e21460831b91ce91438c6ba869c130f7b13f9b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 15e1f2a75cf3229433588554d3c148f24d7109196602591f3b1a834b915c247e05c5564d1b306ab188d6d3c3a5e00c8de5fabb803485d2f7c44d8d7b1b4e4062
|
|
7
|
+
data.tar.gz: bcbfec542d6db6dd57aa16a1f5dd01583a711307fb7ed9eeec267e30881c721640944a3969646936b3a5bfa03836746438828d58bf3b6cff21212d75857832e9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## v0.9.2 2016-11-10
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
* Validation of attributes (params and options) (@nepalez)
|
|
6
|
+
|
|
7
|
+
[Compare v0.9.1...v0.9.2](https://github.com/dry-rb/dry-initializer/compare/v0.9.1...v0.9.2)
|
|
8
|
+
|
|
1
9
|
## v0.9.1 2016-11-06
|
|
2
10
|
|
|
3
11
|
### Added
|
|
@@ -6,7 +14,7 @@
|
|
|
6
14
|
|
|
7
15
|
option :name, as: :username # to take :name option and create :username attribute
|
|
8
16
|
|
|
9
|
-
[Compare
|
|
17
|
+
[Compare v0.9.0...v0.9.1](https://github.com/dry-rb/dry-initializer/compare/v0.9.0...v0.9.1)
|
|
10
18
|
|
|
11
19
|
## v0.9.0 2016-11-06
|
|
12
20
|
|
|
@@ -28,7 +36,7 @@
|
|
|
28
36
|
|
|
29
37
|
* Refactor scope (`using`) to support methods renaming and aliasing (@nepalez)
|
|
30
38
|
|
|
31
|
-
[Compare
|
|
39
|
+
[Compare v0.8.1...v0.9.0](https://github.com/dry-rb/dry-initializer/compare/v0.8.1...v0.9.0)
|
|
32
40
|
|
|
33
41
|
## v0.8.1 2016-11-05
|
|
34
42
|
|
|
@@ -38,7 +46,7 @@
|
|
|
38
46
|
|
|
39
47
|
option :name, Dry::Types['strict.string']
|
|
40
48
|
|
|
41
|
-
[Compare v0.8.0...
|
|
49
|
+
[Compare v0.8.0...v0.8.1](https://github.com/dry-rb/dry-initializer/compare/v0.8.0...v0.8.1)
|
|
42
50
|
|
|
43
51
|
## v0.8.0 2016-11-05
|
|
44
52
|
|
|
@@ -88,7 +96,7 @@ are deprecated and will be removed in the next version of the gem.
|
|
|
88
96
|
* `tolerant_to_unknown_options`
|
|
89
97
|
* `intolerant_to_unknown_options`
|
|
90
98
|
|
|
91
|
-
[Compare v0.7.0...v0.8.0](https://github.com/dry-rb/dry-initializer/compare/v0.7.0
|
|
99
|
+
[Compare v0.7.0...v0.8.0](https://github.com/dry-rb/dry-initializer/compare/v0.7.0...v0.8.0)
|
|
92
100
|
|
|
93
101
|
## v0.7.0 2016-10-11
|
|
94
102
|
|
|
@@ -96,7 +104,7 @@ are deprecated and will be removed in the next version of the gem.
|
|
|
96
104
|
|
|
97
105
|
* Shared settings with `#using` method (@nepalez)
|
|
98
106
|
|
|
99
|
-
[Compare v0.6.0...v0.7.0](https://github.com/dry-rb/dry-initializer/compare/v0.6.0
|
|
107
|
+
[Compare v0.6.0...v0.7.0](https://github.com/dry-rb/dry-initializer/compare/v0.6.0...v0.7.0)
|
|
100
108
|
|
|
101
109
|
## v0.6.0 2016-10-09
|
|
102
110
|
|
|
@@ -104,7 +112,7 @@ are deprecated and will be removed in the next version of the gem.
|
|
|
104
112
|
|
|
105
113
|
* Support for private and protected readers in the `reader:` option (@jmgarnier)
|
|
106
114
|
|
|
107
|
-
[Compare v0.5.0...v0.6.0](https://github.com/dry-rb/dry-initializer/compare/v0.5.0
|
|
115
|
+
[Compare v0.5.0...v0.6.0](https://github.com/dry-rb/dry-initializer/compare/v0.5.0...v0.6.0)
|
|
108
116
|
|
|
109
117
|
## v0.5.0 2016-08-21
|
|
110
118
|
|
|
@@ -112,7 +120,7 @@ are deprecated and will be removed in the next version of the gem.
|
|
|
112
120
|
|
|
113
121
|
* Allow `optional` attribute to be left undefined (@nepalez)
|
|
114
122
|
|
|
115
|
-
[Compare v0.4.0...v0.5.0](https://github.com/dry-rb/dry-initializer/compare/v0.4.0
|
|
123
|
+
[Compare v0.4.0...v0.5.0](https://github.com/dry-rb/dry-initializer/compare/v0.4.0...v0.5.0)
|
|
116
124
|
|
|
117
125
|
## v0.4.0 2016-05-28
|
|
118
126
|
|
|
@@ -120,13 +128,13 @@ are deprecated and will be removed in the next version of the gem.
|
|
|
120
128
|
|
|
121
129
|
* Support of modules and case equality as type constraints (@nepalez)
|
|
122
130
|
|
|
123
|
-
[Compare v0.3.3...v0.4.0](https://github.com/dry-rb/dry-initializer/compare/v0.3.3
|
|
131
|
+
[Compare v0.3.3...v0.4.0](https://github.com/dry-rb/dry-initializer/compare/v0.3.3...v0.4.0)
|
|
124
132
|
|
|
125
133
|
## v0.3.3 2016-05-28
|
|
126
134
|
|
|
127
135
|
* Add deprecation warnings about modules and case equality as type constraints (@nepalez)
|
|
128
136
|
|
|
129
|
-
[Compare v0.3.2...v0.3.3](https://github.com/dry-rb/dry-initializer/compare/v0.3.2
|
|
137
|
+
[Compare v0.3.2...v0.3.3](https://github.com/dry-rb/dry-initializer/compare/v0.3.2...v0.3.3)
|
|
130
138
|
|
|
131
139
|
## v0.3.2 2016-05-25
|
|
132
140
|
|
|
@@ -134,7 +142,7 @@ are deprecated and will be removed in the next version of the gem.
|
|
|
134
142
|
|
|
135
143
|
* Add explicit requirement for ruby 'set' (@rickenharp)
|
|
136
144
|
|
|
137
|
-
[Compare v0.3.1...v0.3.2](https://github.com/dry-rb/dry-initializer/compare/v0.3.1
|
|
145
|
+
[Compare v0.3.1...v0.3.2](https://github.com/dry-rb/dry-initializer/compare/v0.3.1...v0.3.2)
|
|
138
146
|
|
|
139
147
|
## v0.3.1 2016-05-22
|
|
140
148
|
|
|
@@ -142,7 +150,7 @@ are deprecated and will be removed in the next version of the gem.
|
|
|
142
150
|
|
|
143
151
|
* Support for tolerance to unknown options (@nepalez)
|
|
144
152
|
|
|
145
|
-
[Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-initializer/compare/v0.3.0
|
|
153
|
+
[Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-initializer/compare/v0.3.0...v0.3.1)
|
|
146
154
|
|
|
147
155
|
## v0.3.0 2016-05-19
|
|
148
156
|
|
|
@@ -174,7 +182,7 @@ its method #register doesn't mutate the builder instance.
|
|
|
174
182
|
|
|
175
183
|
* Prevent plugin's registry from polluting superclass (@nepalez)
|
|
176
184
|
|
|
177
|
-
[Compare v0.2.1...v0.3.0](https://github.com/dry-rb/dry-initializer/compare/v0.2.1
|
|
185
|
+
[Compare v0.2.1...v0.3.0](https://github.com/dry-rb/dry-initializer/compare/v0.2.1...v0.3.0)
|
|
178
186
|
|
|
179
187
|
### Internals
|
|
180
188
|
|
|
@@ -243,7 +251,7 @@ Default assignments became slower (while plain type constraint are not)!
|
|
|
243
251
|
|
|
244
252
|
```ruby
|
|
245
253
|
option :name, type: /foo/
|
|
246
|
-
option :name, type: (1
|
|
254
|
+
option :name, type: (1...14)
|
|
247
255
|
```
|
|
248
256
|
|
|
249
257
|
* Support defaults and type constraints for the "container" syntax (@nepalez)
|
|
@@ -267,7 +275,7 @@ Default assignments became slower (while plain type constraint are not)!
|
|
|
267
275
|
|
|
268
276
|
### Added
|
|
269
277
|
|
|
270
|
-
* `include Dry::Initializer.define -> do
|
|
278
|
+
* `include Dry::Initializer.define -> do ... end` syntax (@flash-gordon)
|
|
271
279
|
|
|
272
280
|
[Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-initializer/compare/v0.1.0...v0.1.1)
|
|
273
281
|
|
data/dry-initializer.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |gem|
|
|
2
2
|
gem.name = "dry-initializer"
|
|
3
|
-
gem.version = "0.9.
|
|
3
|
+
gem.version = "0.9.2"
|
|
4
4
|
gem.author = ["Vladimir Kochnev (marshall-lee)", "Andrew Kozin (nepalez)"]
|
|
5
5
|
gem.email = ["hashtable@yandex.ru", "andrew.kozin@gmail.com"]
|
|
6
6
|
gem.homepage = "https://github.com/dryrb/dry-initializer"
|
|
@@ -12,8 +12,10 @@ module Dry::Initializer
|
|
|
12
12
|
def add(*args)
|
|
13
13
|
signature = Plugins::Signature.new(*args)
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
validate_order_of signature
|
|
16
|
+
validate_param_uniqueness_of signature
|
|
17
|
+
validate_option_uniqueness_of signature
|
|
18
|
+
validate_attribute_uniqueness_of signature
|
|
17
19
|
|
|
18
20
|
self.class.new(*@list, signature)
|
|
19
21
|
end
|
|
@@ -28,13 +30,27 @@ module Dry::Initializer
|
|
|
28
30
|
|
|
29
31
|
private
|
|
30
32
|
|
|
31
|
-
def
|
|
32
|
-
return unless
|
|
33
|
+
def validate_param_uniqueness_of(signature)
|
|
34
|
+
return unless signature.param?
|
|
35
|
+
return unless select(&:param?).map(&:name).include? signature.name
|
|
33
36
|
|
|
34
37
|
fail RedefinitionError.new(signature.name)
|
|
35
38
|
end
|
|
36
39
|
|
|
37
|
-
def
|
|
40
|
+
def validate_option_uniqueness_of(signature)
|
|
41
|
+
return if signature.param?
|
|
42
|
+
return unless reject(&:param?).map(&:name).include? signature.name
|
|
43
|
+
|
|
44
|
+
fail RedefinitionError.new(signature.name)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def validate_attribute_uniqueness_of(signature)
|
|
48
|
+
return unless map(&:rename).include? signature.rename
|
|
49
|
+
|
|
50
|
+
fail RedefinitionError.new(signature.name)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def validate_order_of(signature)
|
|
38
54
|
return unless signature.required? && signature.param?
|
|
39
55
|
return unless reject(&:required?).any?(&:param?)
|
|
40
56
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dry-initializer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vladimir Kochnev (marshall-lee)
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2016-11-
|
|
12
|
+
date: 2016-11-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rspec
|