class Schedule::Week

Week in yearly Schedule::Schedule

Attributes

days[R]

Array of Days

Public Class Methods

new(month, start_date) click to toggle source

start_date must be Sunday month is the owning month, and may be the different (next) month

# File app/models/schedule/week.rb, line 10
def initialize(month, start_date)
  @start_date = start_date
  if start_date.wday != 0
    raise(ArgumentError, "Must start on Sunday")
  end
  @days = []
  (start_date..start_date + 6).each do |date|
    @days << Day.new(month, date)    
  end
end

Public Instance Methods

to_s() click to toggle source
# File app/models/schedule/week.rb, line 21
def to_s
  "#<Schedule::Week #{@start_date.strftime('%x') if @start_date}>"
end