Class: TimeBoss::Calendar::Quarter

Inherits:
Support::MonthlyUnit show all
Defined in:
lib/timeboss/calendar/quarter.rb

Constant Summary collapse

NUM_MONTHS =
3

Constants inherited from Support::Unit

Support::Unit::UnsupportedUnitError

Constants included from Support::Translatable

Support::Translatable::PERIODS

Instance Attribute Summary

Attributes inherited from Support::MonthlyUnit

#index, #year_index

Attributes inherited from Support::Unit

#calendar, #end_date, #start_date

Instance Method Summary collapse

Methods inherited from Support::MonthlyUnit

#initialize, #to_s, #weeks

Methods inherited from Support::Unit

#+, #-, #==, #current?, #dates, #format, #initialize, #inspect, #offset, #thru, #to_range, type

Methods included from Support::Shiftable

#days_ago, #days_ahead, #halves_ago, #halves_ahead, #in_day, #in_half, #in_month, #in_quarter, #in_week, #in_year, #last_day, #last_half, #last_month, #last_quarter, #last_week, #last_year, #months_ago, #months_ahead, #next_day, #next_half, #next_month, #next_quarter, #next_week, #next_year, #quarters_ago, #quarters_ahead, #this_day, #this_half, #this_month, #this_quarter, #this_week, #this_year, #weeks_ago, #weeks_ahead, #years_ago, #years_ahead

Methods included from Support::Translatable

#day, #days, #half, #halves, #month, #months, #quarter, #quarters, #week, #weeks, #year, #years

Methods included from Support::Navigable

#ago, #ahead, #next, #previous, #until

Constructor Details

This class inherits a constructor from TimeBoss::Calendar::Support::MonthlyUnit

Instance Method Details

#nameString

Get a simple representation of this quarter.

Returns:

  • (String)

    (e.g. “2020Q3”)



12
13
14
# File 'lib/timeboss/calendar/quarter.rb', line 12

def name
  "#{year_index}Q#{index}"
end

#titleString

Get a “pretty” representation of this quarter.

Returns:

  • (String)

    (e.g. “Q3 2020”)



18
19
20
# File 'lib/timeboss/calendar/quarter.rb', line 18

def title
  "Q#{index} #{year_index}"
end