| Total Complexity | 2 |
| Total Lines | 14 |
| Duplicated Lines | 100 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | module Koine |
||
| 4 | View Code Duplication | class ArrayOf < Base |
|
|
|
|||
| 5 | def initialize(adapter) |
||
| 6 | @adapter = adapter |
||
| 7 | with_default_value([]) |
||
| 8 | end |
||
| 9 | |||
| 10 | private |
||
| 11 | |||
| 12 | def coerce_not_nil(collectionOfValues) |
||
| 13 | secure do |
||
| 14 | collectionOfValues.map { |value| @adapter.coerce(value) } |
||
| 15 | end |
||
| 16 | end |
||
| 17 | end |
||
| 18 | end |
||
| 21 |