Class: Comparability::Comparators::NilComparator::NilLastComparator

Inherits:
Comparability::Comparator show all
Includes:
Singleton
Defined in:
lib/comparability/comparators/nil_comparator.rb

Instance Method Summary collapse

Methods inherited from Comparability::Comparator

#to_proc

Methods included from FactoryMethods

#chain, #create, #natural_order, #prioritize_nil, #reverse

Instance Method Details

#compare(me, other) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/comparability/comparators/nil_comparator.rb', line 29

def compare(me, other)
  if me.nil? && other.nil?
    0
  elsif me.nil?
    1
  elsif other.nil?
    -1
  else
    0
  end
end