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 +4 -4
- data/README.md +21 -2
- data/lib/dry/behaviour/black_tie.rb +3 -1
- data/lib/dry/behaviour/version.rb +1 -1
- 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: 3f66c6a8b5a592cdb60a8a95cc706441e9207b4d
|
4
|
+
data.tar.gz: c39d8dde7c915f4d8fe91da105dcb6bd0c42216b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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,
|
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
|
-
|
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
|
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.
|
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-
|
13
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|