timeboss 0.0.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +23 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  4. data/.gitignore +2 -0
  5. data/.travis.yml +4 -1
  6. data/.yardopts +1 -0
  7. data/CODE_OF_CONDUCT.md +76 -0
  8. data/README.md +30 -18
  9. data/bin/tbsh +15 -0
  10. data/doc/TimeBoss.html +146 -0
  11. data/doc/TimeBoss/Calendar.html +137 -0
  12. data/doc/TimeBoss/Calendar/Day.html +594 -0
  13. data/doc/TimeBoss/Calendar/Half.html +396 -0
  14. data/doc/TimeBoss/Calendar/Month.html +396 -0
  15. data/doc/TimeBoss/Calendar/Parser.html +386 -0
  16. data/doc/TimeBoss/Calendar/Period.html +841 -0
  17. data/doc/TimeBoss/Calendar/Quarter.html +396 -0
  18. data/doc/TimeBoss/Calendar/Support.html +131 -0
  19. data/doc/TimeBoss/Calendar/Support/Formatter.html +459 -0
  20. data/doc/TimeBoss/Calendar/Support/MonthBased.html +591 -0
  21. data/doc/TimeBoss/Calendar/Support/MonthBasis.html +437 -0
  22. data/doc/TimeBoss/Calendar/Support/MonthlyUnit.html +591 -0
  23. data/doc/TimeBoss/Calendar/Support/Navigable.html +723 -0
  24. data/doc/TimeBoss/Calendar/Support/Shiftable.html +138 -0
  25. data/doc/TimeBoss/Calendar/Support/Unit.html +1299 -0
  26. data/doc/TimeBoss/Calendar/Waypoints.html +155 -0
  27. data/doc/TimeBoss/Calendar/Waypoints/Absolute.html +1378 -0
  28. data/doc/TimeBoss/Calendar/Waypoints/Relative.html +4308 -0
  29. data/doc/TimeBoss/Calendar/Week.html +671 -0
  30. data/doc/TimeBoss/Calendar/Year.html +319 -0
  31. data/doc/TimeBoss/Calendars.html +336 -0
  32. data/doc/TimeBoss/Calendars/Broadcast.html +221 -0
  33. data/doc/TimeBoss/Calendars/Broadcast/Basis.html +278 -0
  34. data/doc/TimeBoss/Calendars/Entry.html +399 -0
  35. data/doc/TimeBoss/Support.html +115 -0
  36. data/doc/TimeBoss/Support/Shellable.html +249 -0
  37. data/doc/_index.html +416 -0
  38. data/doc/class_list.html +51 -0
  39. data/doc/css/common.css +1 -0
  40. data/doc/css/full_list.css +58 -0
  41. data/doc/css/style.css +496 -0
  42. data/doc/file.README.html +299 -0
  43. data/doc/file_list.html +56 -0
  44. data/doc/frames.html +17 -0
  45. data/doc/index.html +299 -0
  46. data/doc/js/app.js +314 -0
  47. data/doc/js/full_list.js +216 -0
  48. data/doc/js/jquery.js +4 -0
  49. data/doc/method_list.html +1139 -0
  50. data/doc/top-level-namespace.html +110 -0
  51. data/lib/tasks/calendars.rake +5 -0
  52. data/lib/timeboss.rb +4 -0
  53. data/lib/timeboss/calendar.rb +22 -0
  54. data/lib/timeboss/calendar/day.rb +19 -6
  55. data/lib/timeboss/calendar/half.rb +7 -2
  56. data/lib/timeboss/calendar/month.rb +7 -2
  57. data/lib/timeboss/calendar/parser.rb +1 -0
  58. data/lib/timeboss/calendar/period.rb +26 -11
  59. data/lib/timeboss/calendar/quarter.rb +7 -2
  60. data/lib/timeboss/calendar/support.rb +8 -0
  61. data/lib/timeboss/calendar/support/formatter.rb +1 -0
  62. data/lib/timeboss/calendar/support/month_basis.rb +3 -0
  63. data/lib/timeboss/calendar/support/{month_based.rb → monthly_unit.rb} +24 -18
  64. data/lib/timeboss/calendar/support/navigable.rb +73 -0
  65. data/lib/timeboss/calendar/support/shiftable.rb +3 -2
  66. data/lib/timeboss/calendar/support/unit.rb +26 -0
  67. data/lib/timeboss/calendar/waypoints.rb +6 -80
  68. data/lib/timeboss/calendar/waypoints/absolute.rb +114 -0
  69. data/lib/timeboss/calendar/waypoints/relative.rb +268 -0
  70. data/lib/timeboss/calendar/week.rb +26 -18
  71. data/lib/timeboss/calendar/year.rb +6 -5
  72. data/lib/timeboss/calendars.rb +20 -3
  73. data/lib/timeboss/version.rb +1 -1
  74. data/spec/calendar/day_spec.rb +1 -1
  75. data/spec/calendar/support/{month_based_spec.rb → monthly_unit_spec.rb} +18 -8
  76. data/spec/calendar/week_spec.rb +5 -13
  77. data/spec/calendars/broadcast_spec.rb +27 -7
  78. data/spec/calendars_spec.rb +7 -1
  79. data/timeboss.gemspec +1 -0
  80. metadata +77 -8
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+ module TimeBoss
3
+ class Calendar
4
+ module Support
5
+ # Provides navigational abilities for units within a calendar.
6
+ module Navigable
7
+ # @overload previous
8
+ # Fetch the previous unit relative to this unit.
9
+ # @return [Unit]
10
+ # @overload previous(value)
11
+ # Fetch some previous number of units relative to this unit
12
+ # @param quantity [Integer]
13
+ # @return [Array<Unit>]
14
+ def previous(quantity = nil)
15
+ return down if quantity.nil?
16
+ gather(:previous, quantity).reverse
17
+ end
18
+
19
+ # @overload next
20
+ # Fetch the next unit relative to this unit.
21
+ # @return [Unit]
22
+ # @overload next(value)
23
+ # Fetch some next number of units relative to this unit
24
+ # @param quantity [Integer]
25
+ # @return [Array<Unit>]
26
+ def next(quantity = nil)
27
+ return up if quantity.nil?
28
+ gather(:next, quantity)
29
+ end
30
+
31
+ # Fetch the unit some number of units prior to this unit.
32
+ # @param quantity [Integer]
33
+ # @return [Unit]
34
+ def ago(quantity)
35
+ previous(quantity + 1).first
36
+ end
37
+
38
+ # Fetch the unit some number of units after this unit.
39
+ # @param quantity [Integer]
40
+ # @return [Unit]
41
+ def ahead(quantity)
42
+ self.next(quantity + 1).last
43
+ end
44
+
45
+ # Fetch a list of units from this unit until some date.
46
+ # @param end_date [Date]
47
+ # @return [Array<Unit>]
48
+ def until(end_date)
49
+ entry = self
50
+ [entry].tap do |entries|
51
+ until entry.end_date >= end_date
52
+ entry = entry.next
53
+ entries << entry
54
+ end
55
+ end
56
+ end
57
+
58
+ private
59
+
60
+ def gather(navigator, quantity)
61
+ [].tap do |entries|
62
+ entry = self
63
+ while quantity > 0
64
+ entries << entry
65
+ entry = entry.send(navigator)
66
+ quantity -= 1
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -2,6 +2,7 @@
2
2
  module TimeBoss
3
3
  class Calendar
4
4
  module Support
5
+ # Provides the ability to take a unit, and shift it into a different period, relative to today.
5
6
  module Shiftable
6
7
  PERIODS = %w[day week month quarter half year]
7
8
 
@@ -37,12 +38,12 @@ module TimeBoss
37
38
  send("#{periods}_ago", 0)
38
39
  end
39
40
 
40
- define_method "#{periods}_hence" do |offset|
41
+ define_method "#{periods}_ahead" do |offset|
41
42
  send("#{periods}_ago", offset * -1)
42
43
  end
43
44
 
44
45
  define_method "next_#{period}" do
45
- send("#{periods}_hence", 1)
46
+ send("#{periods}_ahead", 1)
46
47
  end
47
48
  end
48
49
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
+ require_relative './navigable'
2
3
  require_relative './shiftable'
3
4
  require_relative './formatter'
4
5
 
5
6
  module TimeBoss
6
7
  class Calendar
7
8
  module Support
9
+ # A unit is the lowest-level base of all days/weeks/months, etc.
8
10
  class Unit
11
+ include Navigable
9
12
  include Shiftable
10
13
  attr_reader :calendar, :start_date, :end_date
11
14
 
@@ -19,22 +22,37 @@ module TimeBoss
19
22
  @end_date = end_date
20
23
  end
21
24
 
25
+ # Is the specified unit equal to this one, based on its unit type and date range?
26
+ # @param entry [Unit] the unit to compare
27
+ # @return [Boolean] true when periods are equal
22
28
  def ==(entry)
23
29
  self.class == entry.class && self.start_date == entry.start_date && self.end_date == entry.end_date
24
30
  end
25
31
 
32
+ # Format this period based on specified granularities.
33
+ # @param periods [Array<Symbol, String>] the periods to include (`half, week`, or `quarter`)
34
+ # @return [String] (e.g. "2020H2W7" or "2020Q3")
26
35
  def format(*periods)
27
36
  Formatter.new(self, periods.presence || Formatter::PERIODS).to_s
28
37
  end
29
38
 
39
+ # Starting from this unit of time, build a period extending through the specified time unit.
40
+ # @param unit [Unit] the period to extend through
41
+ # @return [Period]
30
42
  def thru(unit)
31
43
  Period.new(calendar, self, unit)
32
44
  end
33
45
 
46
+ # Does this period cover the current date?
47
+ # @return [Boolean]
34
48
  def current?
35
49
  Date.today.between?(start_date, end_date)
36
50
  end
37
51
 
52
+ # Return the unit relative to this one by the specified offset.
53
+ # Offset values can be positive or negative.
54
+ # @param value [Integer]
55
+ # @return [Unit]
38
56
  def offset(value)
39
57
  method = value.negative? ? :previous : :next
40
58
  base = self
@@ -42,14 +60,22 @@ module TimeBoss
42
60
  base
43
61
  end
44
62
 
63
+ # Move some number of units forward from this unit.
64
+ # @param value [Integer]
65
+ # @return [Unit]
45
66
  def +(value)
46
67
  offset(value)
47
68
  end
48
69
 
70
+ # Move some number of units backward from this unit.
71
+ # @param value [Integer]
72
+ # @return [Unit]
49
73
  def -(value)
50
74
  offset(-value)
51
75
  end
52
76
 
77
+ # Express this period as a date range.
78
+ # @return [Range<Date, Date>]
53
79
  def to_range
54
80
  @_to_range ||= start_date .. end_date
55
81
  end
@@ -1,87 +1,13 @@
1
1
  # frozen_string_literal: true
2
+
3
+ %w[absolute relative].each { |f| require_relative "./waypoints/#{f}" }
4
+
2
5
  module TimeBoss
3
6
  class Calendar
7
+ # Provides implementations for known periods within a calendar.
4
8
  module Waypoints
5
- %i[month quarter half year].each do |type|
6
- klass = TimeBoss::Calendar.const_get(type.to_s.classify)
7
- size = klass.const_get("NUM_MONTHS")
8
-
9
- define_method type do |year_index, index = 1|
10
- month = (index * size) - size + 1
11
- months = (month .. month + size - 1).map { |i| basis.new(year_index, i) }
12
- klass.new(self, year_index, index, months.first.start_date, months.last.end_date)
13
- end
14
-
15
- define_method "#{type}_for" do |date|
16
- window = send(type, date.year - 1, 1)
17
- while true
18
- break window if window.to_range.include?(date)
19
- window = window.next
20
- end
21
- end
22
- end
23
-
24
- %i[day week month quarter half year].each do |type|
25
- define_method("this_#{type}") { send("#{type}_for", Date.today) }
26
- define_method("last_#{type}") { send("this_#{type}").previous }
27
- define_method("next_#{type}") { send("this_#{type}").next }
28
-
29
- define_method "#{type.to_s.pluralize}_for" do |entry|
30
- first = send("#{type}_for", entry.start_date)
31
- constituents = [first]
32
- until first.end_date >= entry.end_date
33
- first = first.next
34
- constituents << first
35
- end
36
- constituents
37
- end
38
-
39
- define_method "#{type.to_s.pluralize}_back" do |quantity|
40
- windows = []
41
- window = send("this_#{type}")
42
- while quantity > 0
43
- windows << window.dup
44
- window = window.previous
45
- quantity -= 1
46
- end
47
- windows.reverse
48
- end
49
-
50
- define_method "#{type.to_s.pluralize}_ago" do |quantity|
51
- send("#{type.to_s.pluralize}_back", quantity + 1).first
52
- end
53
-
54
- define_method type.to_s.pluralize do |quantity|
55
- windows = []
56
- window = send("this_#{type}")
57
- while quantity > 0
58
- windows << window.dup
59
- window = window.next
60
- quantity -= 1
61
- end
62
- windows
63
- end
64
-
65
- define_method "#{type.to_s.pluralize}_hence" do |quantity|
66
- send(type.to_s.pluralize, quantity + 1).last
67
- end
68
- end
69
-
70
- %i[yesterday today tomorrow].each do |period|
71
- define_method(period) { Day.new(self, Date.send(period)) }
72
- end
73
-
74
- def day(year_index, index)
75
- year(year_index).days[index - 1]
76
- end
77
-
78
- def day_for(date)
79
- Day.new(self, date)
80
- end
81
-
82
- def week_for(date)
83
- year_for(date).weeks.find { |w| w.to_range.include?(date) }
84
- end
9
+ include Absolute
10
+ include Relative
85
11
  end
86
12
  end
87
13
  end
@@ -0,0 +1,114 @@
1
+ # frozen_string_literal: true
2
+ module TimeBoss
3
+ class Calendar
4
+ module Waypoints
5
+ # Provides implementation for absolute periods within a calendar.
6
+ module Absolute
7
+ %i[month quarter half year].each do |type|
8
+ klass = TimeBoss::Calendar.const_get(type.to_s.classify)
9
+ size = klass.const_get("NUM_MONTHS")
10
+
11
+ define_method type do |year_index, index = 1|
12
+ month = (index * size) - size + 1
13
+ months = (month .. month + size - 1).map { |i| basis.new(year_index, i) }
14
+ klass.new(self, year_index, index, months.first.start_date, months.last.end_date)
15
+ end
16
+
17
+ define_method "#{type}_for" do |date|
18
+ window = send(type, date.year - 1, 1)
19
+ while true
20
+ break window if window.to_range.include?(date)
21
+ window = window.next
22
+ end
23
+ end
24
+ end
25
+
26
+ # Get the specified week by index within the specified year.
27
+ # @param year_index [Integer] the year to examine
28
+ # @param index [Integer] the index of the week within the year
29
+ # @return [Calendar::Week]
30
+ def week(year_index, index)
31
+ year(year_index).weeks[index - 1]
32
+ end
33
+
34
+ # Get the week that contains the specified date.
35
+ # @param date [Date] the date for which to locate the calendar week
36
+ # @return [Calendar::Week]
37
+ def week_for(date)
38
+ year_for(date).weeks.find { |w| w.to_range.include?(date) }
39
+ end
40
+
41
+ # Get the specified day by index within the specified year.
42
+ # @param year_index [Integer] the year to examine
43
+ # @param index [Integer] the index of the day within the year
44
+ # @return [Calendar::Day]
45
+ def day(year_index, index)
46
+ year(year_index).days[index - 1]
47
+ end
48
+
49
+ # Get the day that contains the specified date.
50
+ # @param date [Date] the date for which to locate the calendar day
51
+ # @return [Calendar::Day]
52
+ def day_for(date)
53
+ Day.new(self, date)
54
+ end
55
+
56
+ #
57
+ # i hate this
58
+ #
59
+
60
+ ### Month
61
+
62
+ # @!method month
63
+ # Get the specified month by index within the specified year
64
+ # @param year_index [Integer] the year to examine
65
+ # @param index [Integer] the index of the month within the year
66
+ # @return [Calendar::Month]
67
+
68
+ # @!method month_for
69
+ # Get the month that contains the specified date.
70
+ # @param date [Date] the date for which to locate the calendar month
71
+ # @return [Calendar::Month]
72
+
73
+ ### Quarter
74
+
75
+ # @!method quarter
76
+ # Get the specified quarter by index within the specified year
77
+ # @param year_index [Integer] the year to examine
78
+ # @param index [Integer] the index of the quarter within the year
79
+ # @return [Calendar::Quarter]
80
+
81
+ # @!method quarter_for
82
+ # Get the quarter that contains the specified date.
83
+ # @param date [Date] the date for which to locate the calendar quarter
84
+ # @return [Calendar::Quarter]
85
+
86
+ ### Half
87
+
88
+ # @!method half
89
+ # Get the specified half by index within the specified year
90
+ # @param year_index [Integer] the year to examine
91
+ # @param index [Integer] the index of the half within the year
92
+ # @return [Calendar::Half]
93
+
94
+ # @!method half_for
95
+ # Get the half that contains the specified date.
96
+ # @param date [Date] the date for which to locate the calendar half
97
+ # @return [Calendar::Half]
98
+
99
+ ### Year
100
+
101
+ # @!method year
102
+ # Get the specified year by index within the specified year
103
+ # @param year_index [Integer] the year to examine
104
+ # @param index [Integer] the index of the year within the year
105
+ # @return [Calendar::Year]
106
+
107
+ # @!method year_for
108
+ # Get the year that contains the specified date.
109
+ # @param date [Date] the date for which to locate the calendar year
110
+ # @return [Calendar::Year]
111
+ end
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,268 @@
1
+ # frozen_string_literal: true
2
+ module TimeBoss
3
+ class Calendar
4
+ module Waypoints
5
+ # Provides implementation for periods relative to today within a calendar.
6
+ module Relative
7
+ %i[day week month quarter half year].each do |type|
8
+ types = type.to_s.pluralize
9
+
10
+ define_method("this_#{type}") { send("#{type}_for", Date.today) }
11
+ define_method("last_#{type}") { send("this_#{type}").previous }
12
+ define_method("next_#{type}") { send("this_#{type}").next }
13
+
14
+ define_method("#{types}_for") { |p| send("#{type}_for", p.start_date).until(p.end_date) }
15
+
16
+ define_method("#{types}_back") { |q| send("this_#{type}").previous(q) }
17
+ define_method("#{types}_ago") { |q| send("this_#{type}").ago(q) }
18
+
19
+ define_method("#{types}_forward") { |q| send("this_#{type}").next(q) }
20
+ define_method("#{types}_ahead") { |q| send("this_#{type}").ahead(q) }
21
+ alias_method types.to_sym, "#{types}_forward".to_sym
22
+ end
23
+
24
+ alias_method :yesterday, :last_day
25
+ alias_method :today, :this_day
26
+ alias_method :tomorrow, :next_day
27
+
28
+ #
29
+ # i hate this
30
+ #
31
+
32
+ ### Days
33
+
34
+ # @!method this_day
35
+ # Get the current day within the active calendar.
36
+ # @return [Calendar::Day]
37
+
38
+ # @!method last_day
39
+ # Get the previous day within the active calendar.
40
+ # @return [Calendar::Day]
41
+
42
+ # @!method next_day
43
+ # Get the next day within the active calendar.
44
+ # @return [Calendar::Day]
45
+
46
+ # @!method days_for
47
+ # Get a list of days within the specified period unit.
48
+ # @param period [Calendar::Support::Unit] the containing period unit
49
+ # @return [Array<Calendar::Day>]
50
+
51
+ # @!method days_back
52
+ # Get a quantity of days back from today.
53
+ # @param quantity [Integer] the number of days requested
54
+ # @return [Array<Calendar::Day>]
55
+
56
+ # @!method days_ago
57
+ # Get the day that occurred the specified number of days ago.
58
+ # @param quantity [Integer] the number of days before today
59
+ # @return [Calendar::Day]
60
+
61
+ # @!method days_forward
62
+ # Get a quantity of days forward from today.
63
+ # @param quantity [Integer] the number of days requested
64
+ # @return [Array<Calendar::Day>]
65
+
66
+ # @!method days_ahead
67
+ # Get the day that occurred the specified number of days ahead.
68
+ # @param quantity [Integer] the number of days after today
69
+ # @return [Calendar::Day]
70
+
71
+ ### Weeks
72
+
73
+ # @!method this_week
74
+ # Get the current week within the active calendar.
75
+ # @return [Calendar::Week]
76
+
77
+ # @!method last_week
78
+ # Get the previous week within the active calendar.
79
+ # @return [Calendar::Week]
80
+
81
+ # @!method next_week
82
+ # Get the next week within the active calendar.
83
+ # @return [Calendar::Week]
84
+
85
+ # @!method weeks_for
86
+ # Get a list of weeks within the specified period unit.
87
+ # @param period [Calendar::Support::Unit] the containing period unit
88
+ # @return [Array<Calendar::Week>]
89
+
90
+ # @!method weeks_back
91
+ # Get a quantity of weeks back from this week.
92
+ # @param quantity [Integer] the number of weeks requested
93
+ # @return [Array<Calendar::Week>]
94
+
95
+ # @!method weeks_ago
96
+ # Get the week that occurred the specified number of weeks ago.
97
+ # @param quantity [Integer] the number of weeks before this week
98
+ # @return [Calendar::Week]
99
+
100
+ # @!method weeks_forward
101
+ # Get a quantity of weeks forward from this week.
102
+ # @param quantity [Integer] the number of weeks requested
103
+ # @return [Array<Calendar::Week>]
104
+
105
+ # @!method weeks_ahead
106
+ # Get the week that occurred the specified number of weeks ahead.
107
+ # @param quantity [Integer] the number of weeks after this week
108
+ # @return [Calendar::Week]
109
+
110
+ ### Months
111
+
112
+ # @!method this_month
113
+ # Get the current month within the active calendar.
114
+ # @return [Calendar::Month]
115
+
116
+ # @!method last_month
117
+ # Get the previous month within the active calendar.
118
+ # @return [Calendar::Month]
119
+
120
+ # @!method next_month
121
+ # Get the next month within the active calendar.
122
+ # @return [Calendar::Month]
123
+
124
+ # @!method months_for
125
+ # Get a list of months within the specified period unit.
126
+ # @param period [Calendar::Support::Unit] the containing period unit
127
+ # @return [Array<Calendar::Month>]
128
+
129
+ # @!method months_back
130
+ # Get a quantity of months back from this month.
131
+ # @param quantity [Integer] the number of months requested
132
+ # @return [Array<Calendar::Month>]
133
+
134
+ # @!method months_ago
135
+ # Get the month that occurred the specified number of months ago.
136
+ # @param quantity [Integer] the number of months before this month
137
+ # @return [Calendar::Month]
138
+
139
+ # @!method months_forward
140
+ # Get a quantity of months forward from this month.
141
+ # @param quantity [Integer] the number of months requested
142
+ # @return [Array<Calendar::Month>]
143
+
144
+ # @!method months_ahead
145
+ # Get the month that occurred the specified number of months ahead.
146
+ # @param quantity [Integer] the number of months after this month
147
+ # @return [Calendar::Month]
148
+
149
+ ### Quarters
150
+
151
+ # @!method this_quarter
152
+ # Get the current quarter within the active calendar.
153
+ # @return [Calendar::Quarter]
154
+
155
+ # @!method last_quarter
156
+ # Get the previous quarter within the active calendar.
157
+ # @return [Calendar::Quarter]
158
+
159
+ # @!method next_quarter
160
+ # Get the next quarter within the active calendar.
161
+ # @return [Calendar::Quarter]
162
+
163
+ # @!method quarters_for
164
+ # Get a list of quarters within the specified period unit.
165
+ # @param period [Calendar::Support::Unit] the containing period unit
166
+ # @return [Array<Calendar::Quarter>]
167
+
168
+ # @!method quarters_back
169
+ # Get a quantity of quarters back from this quarter.
170
+ # @param quantity [Integer] the number of quarters requested
171
+ # @return [Array<Calendar::Quarter>]
172
+
173
+ # @!method quarters_ago
174
+ # Get the quarter that occurred the specified number of quarters ago.
175
+ # @param quantity [Integer] the number of quarters before this quarter
176
+ # @return [Calendar::Quarter]
177
+
178
+ # @!method quarters_forward
179
+ # Get a quantity of quarters forward from this quarter.
180
+ # @param quantity [Integer] the number of quarters requested
181
+ # @return [Array<Calendar::Quarter>]
182
+
183
+ # @!method quarters_ahead
184
+ # Get the quarter that occurred the specified number of days ahead.
185
+ # @param quantity [Integer] the number of quarters after this quarter
186
+ # @return [Calendar::Quarter]
187
+
188
+ ### Halves
189
+
190
+ # @!method this_half
191
+ # Get the current half within the active calendar.
192
+ # @return [Calendar::Half]
193
+
194
+ # @!method last_half
195
+ # Get the previous half within the active calendar.
196
+ # @return [Calendar::Half]
197
+
198
+ # @!method next_half
199
+ # Get the next half within the active calendar.
200
+ # @return [Calendar::Half]
201
+
202
+ # @!method halves_for
203
+ # Get a list of halves within the specified period unit.
204
+ # @param period [Calendar::Support::Unit] the containing period unit
205
+ # @return [Array<Calendar::Half>]
206
+
207
+ # @!method halves_back
208
+ # Get a quantity of halves back from this half.
209
+ # @param quantity [Integer] the number of halves requested
210
+ # @return [Array<Calendar::Half>]
211
+
212
+ # @!method halves_ago
213
+ # Get the half that occurred the specified number of halves ago.
214
+ # @param quantity [Integer] the number of halves before this half
215
+ # @return [Calendar::Half]
216
+
217
+ # @!method halves_forward
218
+ # Get a quantity of halves forward from this half.
219
+ # @param quantity [Integer] the number of halves requested
220
+ # @return [Array<Calendar::Half>]
221
+
222
+ # @!method halves_ahead
223
+ # Get the half that occurred the specified number of halves ahead.
224
+ # @param quantity [Integer] the number of halves after this half
225
+ # @return [Calendar::Half]
226
+
227
+ ### Years
228
+
229
+ # @!method this_year
230
+ # Get the current year within the active calendar.
231
+ # @return [Calendar::Year]
232
+
233
+ # @!method last_year
234
+ # Get the previous year within the active calendar.
235
+ # @return [Calendar::Year]
236
+
237
+ # @!method next_year
238
+ # Get the next year within the active calendar.
239
+ # @return [Calendar::Year]
240
+
241
+ # @!method years_for
242
+ # Get a list of years within the specified period unit.
243
+ # @param period [Calendar::Support::Unit] the containing period unit
244
+ # @return [Array<Calendar::Year>]
245
+
246
+ # @!method years_back
247
+ # Get a quantity of years back from this year.
248
+ # @param quantity [Integer] the number of years requested
249
+ # @return [Array<Calendar::Year>]
250
+
251
+ # @!method years_ago
252
+ # Get the year that occurred the specified number of years ago.
253
+ # @param quantity [Integer] the number of years before this year
254
+ # @return [Calendar::Year]
255
+
256
+ # @!method years_forward
257
+ # Get a quantity of years forward from this year.
258
+ # @param quantity [Integer] the number of years requested
259
+ # @return [Array<Calendar::Year>]
260
+
261
+ # @!method years_ahead
262
+ # Get the year that occurred the specified number of years ahead.
263
+ # @param quantity [Integer] the number of years after this year
264
+ # @return [Calendar::Year]
265
+ end
266
+ end
267
+ end
268
+ end