Completed
Push — dev ( ffd8f7...ec8098 )
by Fike
51s
created

Type

Complexity

Total Complexity 0

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 12
Bugs 0 Features 0
Metric Value
wmc 0
c 12
b 0
f 0
dl 0
loc 27

1 Nested-Class

Rating   Name  
A Pair

4 Methods

Rating   Name   Duplication   Size   Complexity  
A Pair.eql? 0 4 2
A Pair.hash() 0 3 1
A Pair.initialize() 0 4 1
A Pair.==() 0 3 1
1
# frozen_string_literal: true
2
3
module AMA
4
  module Entity
5
    class Mapper
6
      class Type
7
        module Aux
8
          # Simple class to store paired data items
9
          class Pair
10
            attr_accessor :left
11
            attr_accessor :right
12
13
            def initialize(left: nil, right: nil)
14
              @left = left
15
              @right = right
16
            end
17
18
            def hash
19
              @left.hash ^ @right.hash
20
            end
21
22
            def eql?(other)
23
              return false unless other.is_a?(Pair)
24
              @left == other.left && @right == other.right
25
            end
26
27
            def ==(other)
28
              eql?(other)
29
            end
30
          end
31
        end
32
      end
33
    end
34
  end
35
end
36