Sha256: a79b28ee15872c4c6b56452d3ed2776397dbd0df1b68b984502c10015a846da4

Contents?: true

Size: 532 Bytes

Versions: 7

Compression:

Stored size: 532 Bytes

Contents

require 'active_support/core_ext/module/delegation'

module Cal
  class Day

    include Comparable

    def initialize(date, calendar)
      @date = date
      @calendar = calendar
    end

    attr_reader :calendar, :date

    delegate :today?, :to => :date

    def ==(other)
      other.is_a?(Day) && calendar == other.calendar && date == other.date
    end

    def <=>(other)
      date <=> other.date
    end

    def succ
      self.class.new date.tomorrow, calendar
    end

    def number
      date.day
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cal-0.6.1 lib/cal/day.rb
cal-0.5.1 lib/cal/day.rb
cal-0.5.0 lib/cal/day.rb
cal-0.4.1 lib/cal/day.rb
cal-0.4.0 lib/cal/day.rb
cal-0.3.0 lib/cal/day.rb
cal-0.2.1 lib/cal/day.rb