Sha256: bb11c5541417e0e2f72c8053cd69dda53e873e23f5b71fcdd0e141561a3b9417

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 Bytes

Contents

module Chronic
  class MiniDate
    attr_accessor :month, :day

    def initialize(month, day)
      @month = month
      @day = day
    end

    def is_between?(md_start, md_end)
      return true if (@month == md_start.month and @day >= md_start.day) ||
                     (@month == md_end.month and @day <= md_end.day)

      i = md_start.month + 1
      until i == md_end.month
        return true if @month == i
        i = (i+1) % 12
      end

      return false
    end

    def equals?(other)
      @month == other.month and day == other.day
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chronic-0.4.0 lib/chronic/mini_date.rb