Total Complexity | 3 |
Total Lines | 18 |
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 | def for_values |
||
11 | @adapter |
||
12 | end |
||
13 | |||
14 | private |
||
15 | |||
16 | def coerce_not_nil(collectionOfValues) |
||
17 | secure do |
||
18 | collectionOfValues.map { |value| @adapter.coerce(value) } |
||
19 | end |
||
20 | end |
||
21 | end |
||
22 | end |
||
25 |