Total Complexity | 5 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | # frozen_string_literal: true |
||
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 |
||
36 |