class Fugit::Nat::SlotGroup
def determine_hms
def determine_hms return [ [ [ '*' ], [ '*' ] ] ] if @hms.empty? hms = @hms.dup # while ig = (hms.count > 1 && hms.index { |hm| hm.graded? }) do sg = hms[ig] so = hms.delete_at(ig == 0 ? 1 : ig - 1) sg.append(so) end hms .collect(&:a) .inject({}) { |r, hm| hm[1].each { |m| (r[m] ||= []).concat(hm[0]) } r } .inject({}) { |r, (m, hs)| (r[hs.sort] ||= []) << m r } .to_a end