Module: ResultClassComponents::Comparison

Defined in:
lib/kweerie/result_class_components/comparison.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



5
6
7
8
9
# File 'lib/kweerie/result_class_components/comparison.rb', line 5

def <=>(other)
  return nil unless other.is_a?(self.class)

  to_h <=> other.to_h
end

#==(other) ⇒ Object



11
12
13
14
15
# File 'lib/kweerie/result_class_components/comparison.rb', line 11

def ==(other)
  return false unless other.is_a?(self.class)

  to_h == other.to_h
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/kweerie/result_class_components/comparison.rb', line 17

def eql?(other)
  self == other
end

#hashObject



21
22
23
# File 'lib/kweerie/result_class_components/comparison.rb', line 21

def hash
  to_h.hash
end