Sha256: abcc560b9c55960a6330e6516fb0c7724aa8ca95dbf16f69a58bf7a030fe829d
Contents?: true
Size: 548 Bytes
Versions: 17
Compression:
Stored size: 548 Bytes
Contents
module USaidWat module Algorithms class Algorithm attr_reader :buckets def initialize(buckets) @buckets = buckets end def sort(a, b) a <=> b end end class LexicographicalAlgorithm < Algorithm def sort(a, b) a.downcase <=> b.downcase end end class CountAlgorithm < Algorithm def sort(a, b) if buckets[a] == buckets[b] a.downcase <=> b.downcase else buckets[b] <=> buckets[a] end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems