class Koyomi::MonthCycle

Attributes

dates[R]
koyomi_month[R]

Public Class Methods

new(koyomi_month) click to toggle source
Calls superclass method
# File lib/koyomi/month_cycle.rb, line 7
def initialize(koyomi_month)
  super()
  @koyomi_month = koyomi_month
  @dates = []
end

Public Instance Methods

add(*args) click to toggle source
# File lib/koyomi/month_cycle.rb, line 13
def add(*args)

  while arg = args.shift
    case arg
    when Date
      raise Koyomi::WrongRangeError unless koyomi_month.range.include?(arg)
      @dates << arg
    else
      #_args = [arg]
      #_args << args.shift
      @dates += koyomi_month.cycles(*arg)
    end
  end
  uniq_and_sort
  self
end

Private Instance Methods

uniq_and_sort() click to toggle source
# File lib/koyomi/month_cycle.rb, line 32
def uniq_and_sort
  @dates = @dates.uniq.sort
end