HashTuple.initialize()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 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 HashTuple
10
            attr_accessor :key
11
            attr_accessor :value
12
13
            def initialize(key: nil, value: nil)
14
              @key = key
15
              @value = value
16
            end
17
18
            def hash
19
              @key.hash ^ @value.hash
20
            end
21
22
            def eql?(other)
23
              return false unless other.is_a?(HashTuple)
24
              @key == other.key && @value == other.value
25
            end
26
27
            def ==(other)
28
              eql?(other)
29
            end
30
          end
31
        end
32
      end
33
    end
34
  end
35
end
36