README.md in dry-behaviour-0.2.0 vs README.md in dry-behaviour-0.2.1
- old
+ new
@@ -20,19 +20,19 @@
def add_default(value)
add(3, 2) + value
end
end
- defimpl Protocols::Adder, for: String do
+ defimpl Protocols::Adder, target: String do
def add(this, other)
this * other
end
def subtract(this, other)
this
end
end
- defimpl Protocols::Adder, for: NilClass do
+ defimpl Protocols::Adder, target: NilClass do
def add(this, other)
other
end
def subtract(this, other)
this
@@ -61,9 +61,28 @@
## Authors
@am-kantox, @saverio-kantox & @kantox
## Changelog
+
+### `0.2.1` :: multiple targets
+
+#### Multiple targets:
+
+```ruby
+defimpl MyProto, target: [MyClass1, MyClass2], delegate: [:add, :subtract]
+```
+
+### `0.2.0` :: implicit delegate on incomplete implementation
+
+when `defimpl` does not fully cover the protocol declaration,
+missing methods are implicitly delegated to the target,
+the warning is being issued:
+
+```ruby
+defimpl MyProto, target: MyClass, map: { add: :+, subtract: :- }
+#⇒ W, [2016-10-24T14:52:49.230808 #26382] WARN -- : Implicit delegate MyProto#to_s to MyClass
+```
### `0.1.1` :: delegate and map methods to receiver
`defimpl` now accepts `delegate` and `map`: