docs/Duplicate-Method-Call.md in reek-4.0.3 vs docs/Duplicate-Method-Call.md in reek-4.0.4
- old
+ new
@@ -8,29 +8,33 @@
## Example
Here's a very much simplified and contrived example. The following method will report a warning:
```Ruby
-def double_thing()
+def double_thing
@other.thing + @other.thing
end
```
One quick approach to silence Reek would be to refactor the code thus:
```Ruby
-def double_thing()
+def double_thing
thing = @other.thing
thing + thing
end
```
-A slightly different approach would be to replace all calls of `double_thing` by calls to `@other.double_thing`:
+A slightly different approach would be to replace all calls in `double_thing` by calls to `thing`:
```Ruby
class Other
- def double_thing()
+ def double_thing
thing + thing
+ end
+
+ def thing
+ @other.thing
end
end
```
The approach you take will depend on balancing other factors in your code.