dry-initializer 1.1.1 → 1.1.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 +7 -0
- data/dry-initializer.gemspec +1 -1
- data/lib/dry/initializer/attribute.rb +1 -0
- data/lib/dry/initializer/builder.rb +9 -0
- data/spec/spec_helper.rb +2 -0
- 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: 20cf50ce37d17f26999e8358b5b09a4c4ec82c68
|
4
|
+
data.tar.gz: 4ccf82f6bd1b1cd88629dc8c43224edfb3d946d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48527c5a5de33cd56113db923d39bfade78a371f51cd58ed91e1b0f0f112e05b151e2d97a67db117c695ece5354f4779fabe0c2dad261348ef678d63f6de80bf
|
7
|
+
data.tar.gz: 074c19a69832ddd9a96d3808da5f7bb50b189ad6f71a9370041e03e530cdf48efbe90438a1536912e596c76c1febc263d2a5dc2a0f022e5823b0d69cbf2ab1ef
|
data/CHANGELOG.md
CHANGED
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 = "1.1.
|
3
|
+
gem.version = "1.1.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"
|
@@ -59,6 +59,7 @@ module Dry::Initializer
|
|
59
59
|
command = %w(private protected).include?(reader.to_s) ? reader : :public
|
60
60
|
|
61
61
|
<<-RUBY.gsub(/^ *\|/, "")
|
62
|
+
|undef_method :#{target} if method_defined?(:#{target}) || protected_method_defined?(:#{target}) || private_method_defined?(:#{target})
|
62
63
|
|def #{target}
|
63
64
|
| @#{target} unless @#{target} == Dry::Initializer::UNDEFINED
|
64
65
|
|end
|
@@ -11,8 +11,13 @@ module Dry::Initializer
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def call(mixin)
|
14
|
+
clear_method(mixin, :__defaults__)
|
15
|
+
clear_method(mixin, :__coercers__)
|
16
|
+
clear_method(mixin, :__initialize__)
|
17
|
+
|
14
18
|
defaults = send(:defaults)
|
15
19
|
coercers = send(:coercers)
|
20
|
+
|
16
21
|
mixin.send(:define_method, :__defaults__) { defaults }
|
17
22
|
mixin.send(:define_method, :__coercers__) { coercers }
|
18
23
|
mixin.class_eval(code, __FILE__, __LINE__ + 1)
|
@@ -30,6 +35,10 @@ module Dry::Initializer
|
|
30
35
|
collection.dup.tap { |list| list[index] = new_item }
|
31
36
|
end
|
32
37
|
|
38
|
+
def clear_method(mixin, name)
|
39
|
+
mixin.send(:undef_method, name) if mixin.private_method_defined? name
|
40
|
+
end
|
41
|
+
|
33
42
|
def code
|
34
43
|
<<-RUBY.gsub(/^ +\|/, "")
|
35
44
|
|def __initialize__(#{initializer_signatures})
|
data/spec/spec_helper.rb
CHANGED
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: 1.1.
|
4
|
+
version: 1.1.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: 2017-02-
|
12
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|