Completed
Push — master ( 74519f...bcfd93 )
by Marcelo
40s
created

ArrayOf   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
dl 18
loc 18
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 4 4 1
A for_values() 3 3 1
A coerce_not_nil() 5 5 1

How to fix   Duplicated Code   

Duplicated Code

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
2
  module Attributes
3
    module Adapter
4 View Code Duplication
      class ArrayOf < Base
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
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
23
  end
24
end
25