compwron/pairSee

View on GitHub
lib/pair_see/date_combo.rb

Summary

Maintainability
A
0 mins
Test Coverage
module PairSee
  class DateCombo
    attr_reader :date, :devs

    def initialize(date, *devs)
      @date = date
      @devs = devs
    end

    def to_s
      if date.nil?
        "#{devs.join ', '}: not yet"
      else
        "#{devs.join ', '}: #{date}"
      end
    end

    def <=>(other)
      if date && other.date
        date <=> other.date
      elsif date
        1
      elsif other.date
        -1
      else
        0
      end
    end
  end
end