dry-behaviour 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 822ccca7591e84e8f437fb9942ed3e2b0857ebbe
4
- data.tar.gz: 80cc1b146e8caf3a3292c3ffc55cf0f88d64b9a6
3
+ metadata.gz: 3f66c6a8b5a592cdb60a8a95cc706441e9207b4d
4
+ data.tar.gz: c39d8dde7c915f4d8fe91da105dcb6bd0c42216b
5
5
  SHA512:
6
- metadata.gz: 8fdff2c37197e6ea799e23618a33cb06f8fce388a67ad0a24f79b5e1cf2afe89ee6ab7d7fcfbb2cbab15789740e3ac7cdbc6ccf463644e6df7b85e6f8f8239c6
7
- data.tar.gz: b52c34a6dc9d690f6807b6b810bb6b336b278b8ac039e23352a200f02fa526e093e118888bb0c8452098ffddbdbac01309b5768281e1c19b39e0de4780e964c1
6
+ metadata.gz: 697e0ee4478d5b4aceef4509edc2f0e3733f000b52871d18d9eb9193be876a80e5e15b6aac7724f52534ae69e238ed1b7e99429b25ed8adb3589bd69e19ef548
7
+ data.tar.gz: 02845aea1c9d5f3fd66e13ad9c1860b863a984758a309fadea6ab7b8275965c416ff1410d58df8047d257bb9e013b1edb29bda2e25a137b4fb5f1ff1fa090426
data/README.md CHANGED
@@ -22,7 +22,7 @@ module Protocols
22
22
  end
23
23
  end
24
24
 
25
- defimpl Protocols::Adder, for: String do
25
+ defimpl Protocols::Adder, target: String do
26
26
  def add(this, other)
27
27
  this * other
28
28
  end
@@ -30,7 +30,7 @@ module Protocols
30
30
  this
31
31
  end
32
32
  end
33
- defimpl Protocols::Adder, for: NilClass do
33
+ defimpl Protocols::Adder, target: NilClass do
34
34
  def add(this, other)
35
35
  other
36
36
  end
@@ -64,6 +64,25 @@ expect(Protocols::Adder.add_default(1)).to eq(6)
64
64
 
65
65
  ## Changelog
66
66
 
67
+ ### `0.2.1` :: multiple targets
68
+
69
+ #### Multiple targets:
70
+
71
+ ```ruby
72
+ defimpl MyProto, target: [MyClass1, MyClass2], delegate: [:add, :subtract]
73
+ ```
74
+
75
+ ### `0.2.0` :: implicit delegate on incomplete implementation
76
+
77
+ when `defimpl` does not fully cover the protocol declaration,
78
+ missing methods are implicitly delegated to the target,
79
+ the warning is being issued:
80
+
81
+ ```ruby
82
+ defimpl MyProto, target: MyClass, map: { add: :+, subtract: :- }
83
+ #⇒ W, [2016-10-24T14:52:49.230808 #26382] WARN -- : Implicit delegate MyProto#to_s to MyClass
84
+ ```
85
+
67
86
  ### `0.1.1` :: delegate and map methods to receiver
68
87
 
69
88
  `defimpl` now accepts `delegate` and `map`:
@@ -66,7 +66,9 @@ module Dry
66
66
  acc << m
67
67
  end
68
68
  end.each do |m|
69
- BlackTie.implementations[protocol || self][target][m] = mod.method(m).to_proc
69
+ [*target].each do |tgt|
70
+ BlackTie.implementations[protocol || self][tgt][m] = mod.method(m).to_proc
71
+ end
70
72
  end
71
73
  end
72
74
  end
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Behaviour
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.2.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-behaviour
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksei Matiushkin
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-10-24 00:00:00.000000000 Z
13
+ date: 2016-10-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler