Module: TimeBoss::Calendar::Waypoints::Absolute

Included in:
TimeBoss::Calendar::Waypoints
Defined in:
lib/timeboss/calendar/waypoints/absolute.rb

Instance Method Summary collapse

Instance Method Details

#day(year_index, index) ⇒ Calendar::Day

Get the specified day by index within the specified year.

Parameters:

  • year_index (Integer)

    the year to examine

  • index (Integer)

    the index of the day within the year

Returns:



45
46
47
# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 45

def day(year_index, index)
  year(year_index).days[index - 1]
end

#day_for(date) ⇒ Calendar::Day

Get the day that contains the specified date.

Parameters:

  • date (Date)

    the date for which to locate the calendar day

Returns:



52
53
54
# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 52

def day_for(date)
  Day.new(self, date)
end

#halfCalendar::Half

Get the specified half by index within the specified year

Parameters:

  • year_index (Integer)

    the year to examine

  • index (Integer)

    the index of the half within the year

Returns:



# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 88

#half_forCalendar::Half

Get the half that contains the specified date.

Parameters:

  • date (Date)

    the date for which to locate the calendar half

Returns:



# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 94

#monthCalendar::Month

Get the specified month by index within the specified year

Parameters:

  • year_index (Integer)

    the year to examine

  • index (Integer)

    the index of the month within the year

Returns:



# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 62

#month_forCalendar::Month

Get the month that contains the specified date.

Parameters:

  • date (Date)

    the date for which to locate the calendar month

Returns:



# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 68

#quarterCalendar::Quarter

Get the specified quarter by index within the specified year

Parameters:

  • year_index (Integer)

    the year to examine

  • index (Integer)

    the index of the quarter within the year

Returns:



# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 75

#quarter_forCalendar::Quarter

Get the quarter that contains the specified date.

Parameters:

  • date (Date)

    the date for which to locate the calendar quarter

Returns:



# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 81

#week(year_index, index) ⇒ Calendar::Week

Get the specified week by index within the specified year.

Parameters:

  • year_index (Integer)

    the year to examine

  • index (Integer)

    the index of the week within the year

Returns:



30
31
32
# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 30

def week(year_index, index)
  year(year_index).weeks[index - 1]
end

#week_for(date) ⇒ Calendar::Week

Get the week that contains the specified date.

Parameters:

  • date (Date)

    the date for which to locate the calendar week

Returns:



37
38
39
# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 37

def week_for(date)
  year_for(date).weeks.find { |w| w.to_range.include?(date) }
end

#yearCalendar::Year

Get the specified year by index within the specified year

Parameters:

  • year_index (Integer)

    the year to examine

  • index (Integer)

    the index of the year within the year

Returns:



# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 101

#year_forCalendar::Year

Get the year that contains the specified date.

Parameters:

  • date (Date)

    the date for which to locate the calendar year

Returns:



# File 'lib/timeboss/calendar/waypoints/absolute.rb', line 107