Class: SOF::Cycles::Within
Constant Summary
Constants inherited
from SOF::Cycle
SOF::Cycle::VERSION
Instance Attribute Summary
Attributes inherited from SOF::Cycle
#parser
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from SOF::Cycle
#==, #as_json, class_for_kind, class_for_notation_id, #considered_dates, #cover?, #covered_dates, cycle_handlers, dump, #expiration_of, for, #from_data, handles?, #humanized_span, inherited, #initialize, #kind_inquiry, #last_completed, legend, load, notation, #notation, #range, #satisfied_by?, #to_h, validate_period, #validate_period, volume_only?, #volume_to_delay_expiration
Constructor Details
This class inherits a constructor from SOF::Cycle
Class Method Details
.description ⇒ Object
15
16
17
|
# File 'lib/sof/cycles/within.rb', line 15
def self.description
"Within - occurrences within a time period from a specific date"
end
|
.dormant_capable? ⇒ Boolean
13
|
# File 'lib/sof/cycles/within.rb', line 13
def self.dormant_capable? = true
|
.examples ⇒ Object
19
20
21
|
# File 'lib/sof/cycles/within.rb', line 19
def self.examples
["V2W3DF2024-01-01 - twice within 3 days from Jan 1, 2024"]
end
|
.recurring? ⇒ Boolean
11
|
# File 'lib/sof/cycles/within.rb', line 11
def self.recurring? = false
|
Instance Method Details
#date_range ⇒ Object
33
34
35
36
37
|
# File 'lib/sof/cycles/within.rb', line 33
def date_range
return humanized_span unless active?
[start_date, final_date].map { it.to_fs(:american) }.join(" - ")
end
|
#extend_period(count) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/sof/cycles/within.rb', line 25
def extend_period(count)
Cycle.for(
Parser.load(
parser.to_h.merge(period_count: period_count + count)
).to_s
)
end
|
#final_date(_ = nil) ⇒ Object
39
|
# File 'lib/sof/cycles/within.rb', line 39
def final_date(_ = nil) = time_span.end_date(start_date)
|
#start_date(_ = nil) ⇒ Object
41
|
# File 'lib/sof/cycles/within.rb', line 41
def start_date(_ = nil) = from_date.to_date
|
#to_s ⇒ Object
23
|
# File 'lib/sof/cycles/within.rb', line 23
def to_s = "#{volume}x within #{date_range}"
|