class TickTack::Day

Attributes

date[R]

Public Class Methods

new(calendar, year_i = nil, month_i = nil, day_i = nil) click to toggle source
# File lib/tick_tack/day.rb, line 8
def initialize(calendar, year_i = nil, month_i = nil, day_i = nil)
  @calendar = calendar
  init_year(year_i)
  init_month(month_i)
  init_day(day_i)

  @date = Date.new(self.year_i, self.month_i, self.day_i)
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/tick_tack/day.rb, line 43
def <=>(other)
  self.date <=> other.date
end
next() click to toggle source
# File lib/tick_tack/day.rb, line 31
def next
  next_date = @date.next_day
  @calendar.day(next_date.year, next_date.month, next_date.day)
end
Also aliased as: succ
prev()
Alias for: previous
previous() click to toggle source
# File lib/tick_tack/day.rb, line 37
def previous
  prev_date = @date.prev_day
  @calendar.day(prev_date.year, prev_date.month, prev_date.day)
end
Also aliased as: prev
succ()
Alias for: next
week_end() click to toggle source
# File lib/tick_tack/day.rb, line 22
def week_end
  week_end = week_start.date + 6
  @calendar.day(week_end.year, week_end.month, week_end.day)
end
week_start() click to toggle source
# File lib/tick_tack/day.rb, line 17
def week_start
  week_start = date - (date.wday - @calendar.conf[:dow]) % 7
  @calendar.day(week_start.year, week_start.month, week_start.day)
end
weekdays() click to toggle source
# File lib/tick_tack/day.rb, line 27
def weekdays
  (week_start..week_end).to_a
end