Class: Antlr4::Runtime::ObjectEqualityComparator

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/antlr4/runtime/object_equality_comparator.rb

Instance Method Summary collapse

Instance Method Details

#compare(a, b) ⇒ Object



12
13
14
15
16
# File 'lib/antlr4/runtime/object_equality_comparator.rb', line 12

def compare(a, b)
  return 1 if a.nil? || b.nil?

  a <=> b
end

#hash(obj) ⇒ Object



6
7
8
9
10
# File 'lib/antlr4/runtime/object_equality_comparator.rb', line 6

def hash(obj)
  return 0 if obj.nil?

  obj.hash
end