Class: Chronic::RepeaterQuarter
- Inherits:
-
Repeater
show all
- Defined in:
- lib/chronic/repeaters/repeater_quarter.rb
Overview
Constant Summary
collapse
- MONTHS_PER_QUARTER =
3
- QUARTER_SECONDS =
7_776_000
Instance Attribute Summary
Attributes inherited from Tag
#type
Instance Method Summary
collapse
Methods inherited from Repeater
#<=>, scan, scan_for_day_names, scan_for_day_portions, scan_for_month_names, scan_for_quarter_names, scan_for_season_names, scan_for_times, scan_for_units
Methods inherited from Tag
#initialize, scan, #start=
Constructor Details
This class inherits a constructor from Chronic::Tag
Instance Method Details
#next(pointer) ⇒ Object
6
7
8
9
10
|
# File 'lib/chronic/repeaters/repeater_quarter.rb', line 6
def next(pointer)
@current_span ||= quarter(@now)
offset_quarter_amount = pointer == :future ? 1 : -1
@current_span = offset_quarter(@current_span.begin, offset_quarter_amount)
end
|
#offset(span, amount, pointer) ⇒ Object
16
17
18
19
|
# File 'lib/chronic/repeaters/repeater_quarter.rb', line 16
def offset(span, amount, pointer)
direction = pointer == :future ? 1 : -1
offset_quarter(span.begin, amount * direction)
end
|
#this ⇒ Object
12
13
14
|
# File 'lib/chronic/repeaters/repeater_quarter.rb', line 12
def this(*)
@current_span = quarter(@now)
end
|
#to_s ⇒ Object
25
26
27
|
# File 'lib/chronic/repeaters/repeater_quarter.rb', line 25
def to_s
super << '-quarter'
end
|
#width ⇒ Object
21
22
23
|
# File 'lib/chronic/repeaters/repeater_quarter.rb', line 21
def width
@current_span ? @current_span.width : QUARTER_SECONDS
end
|