dry-initializer 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5bb3cc8fc0769ecd8c81518372df7bb0d74969f4
4
- data.tar.gz: ace5842b26ce417325dbd6b1f653a3ffd1212c47
3
+ metadata.gz: 20cf50ce37d17f26999e8358b5b09a4c4ec82c68
4
+ data.tar.gz: 4ccf82f6bd1b1cd88629dc8c43224edfb3d946d6
5
5
  SHA512:
6
- metadata.gz: 48e0d784c9b40a88473e22bbb075ef31074ea207f864093f144a7792c3e485b8ffe92a95fd164d3b27a1301131c4b10006bd9a6631e2ed0509c49e1bc7263551
7
- data.tar.gz: fc4bf50667a8a5164d957851cad69976941a240be37aa3bc8c68201dadfdce1a521d687e327a42bc22c87d72378c10169b1691a502ffa228895a6e83bba435e7
6
+ metadata.gz: 48527c5a5de33cd56113db923d39bfade78a371f51cd58ed91e1b0f0f112e05b151e2d97a67db117c695ece5354f4779fabe0c2dad261348ef678d63f6de80bf
7
+ data.tar.gz: 074c19a69832ddd9a96d3808da5f7bb50b189ad6f71a9370041e03e530cdf48efbe90438a1536912e596c76c1febc263d2a5dc2a0f022e5823b0d69cbf2ab1ef
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## v1.1.2 2017-02-06
2
+
3
+ # Internals
4
+ - Remove previously defined methods before redefining them (flash-gordon)
5
+
6
+ [Compare v1.1.1...v1.1.2](https://github.com/dry-rb/dry-initializer/compare/v1.1.1...v1.1.2)
7
+
1
8
  ## v1.1.1 2017-02-04
2
9
 
3
10
  # Bugs Fixed
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "dry-initializer"
3
- gem.version = "1.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
@@ -11,4 +11,6 @@ RSpec.configure do |config|
11
11
  example.run
12
12
  Object.send :remove_const, :Test
13
13
  end
14
+
15
+ config.warnings = true
14
16
  end
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.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-04 00:00:00.000000000 Z
12
+ date: 2017-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec