class TimeBoss::Calendar::Period
Attributes
begin[R]
calendar[R]
end[R]
Public Class Methods
new(calendar, begin_basis, end_basis = nil)
click to toggle source
# File lib/timeboss/calendar/period.rb, line 142 def initialize(calendar, begin_basis, end_basis = nil) @calendar = calendar @begin = begin_basis @end = end_basis || @begin end
Public Instance Methods
current?()
click to toggle source
Does this period cover the current date? @return [Boolean]
# File lib/timeboss/calendar/period.rb, line 110 def current? to_range.include?(Date.today) end
inspect()
click to toggle source
# File lib/timeboss/calendar/period.rb, line 134 def inspect "#<#{self.class.name}[#{self.begin.inspect}..#{self.end.inspect}] start_date=#{start_date}, end_date=#{end_date}>" end
to_range()
click to toggle source
Express this period as a date range. @return [Range<Date, Date>]
# File lib/timeboss/calendar/period.rb, line 130 def to_range @_to_range ||= start_date..end_date end
Private Instance Methods
build_entries(entry)
click to toggle source
# File lib/timeboss/calendar/period.rb, line 148 def build_entries(entry) return [] if entry.start_date > self.end.end_date entries = [entry] while entry.end_date < self.end.end_date entry = entry.next entries << entry end entries end