Class: USaidWat::Algorithms::CountAlgorithm

Inherits:
Algorithm
  • Object
show all
Defined in:
lib/usaidwat/algo.rb

Instance Attribute Summary

Attributes inherited from Algorithm

#buckets

Instance Method Summary collapse

Methods inherited from Algorithm

#initialize

Constructor Details

This class inherits a constructor from USaidWat::Algorithms::Algorithm

Instance Method Details

#sort(a, b) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/usaidwat/algo.rb', line 22

def sort(a, b)
  if buckets[a] == buckets[b]
    a.downcase <=> b.downcase
  else
    buckets[b] <=> buckets[a]
  end
end