README.md in dry-behaviour-0.1.0 vs README.md in dry-behaviour-0.1.1
- old
+ new
@@ -37,18 +37,12 @@
def subtract(this, other)
this
end
end
- defimpl for: Integer do
- def add(this, other)
- this + other
- end
- def subtract(this, other)
- this - other
- end
- end
+ # delegate `to_s` as is, map `add` and `subtract` to `:+` and `:-` respectively
+ defimpl target: Integer, delegate: :to_s, map: { add: :+, subtract: :- }
end
end
```
## Usage
@@ -65,9 +59,19 @@
```
## Authors
@am-kantox, @saverio-kantox & @kantox
+
+## Changelog
+
+### `0.1.1` :: delegate and map methods to receiver
+
+`defimpl` now accepts `delegate` and `map`:
+
+```ruby
+defimpl MyProto, target: MyClass, delegate: :to_s, map: { add: :+, subtract: :- }
+```
## Installation
Add this line to your application's Gemfile: