Sha256: c3ae2874f98a6a60701d1bc94c77026780345e093bbae5965a2e29411aa94acf
Contents?: true
Size: 546 Bytes
Versions: 3
Compression:
Stored size: 546 Bytes
Contents
module Reponaut module Application class Sorter attr_reader :name, :count def initialize(pair) @name, @count = pair end end class LexicographicalSorter < Sorter def <=>(o) return nil unless o.kind_of? self.class name <=> o.name end end class NumericalSorter < Sorter def <=>(o) return nil unless o.kind_of? self.class if count == o.count name <=> o.name else o.count <=> count end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reponaut-2.1.1 | lib/reponaut/sorter.rb |
reponaut-2.1.0 | lib/reponaut/sorter.rb |
reponaut-2.0.0 | lib/reponaut/sorter.rb |