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, #dormant_capable?, dump, #expiration_of, for, #from_data, handles, handles?, #humanized_span, #initialize, #kind_inquiry, #last_completed, legend, load, notation, #notation, #range, register, registry, #reset_by, #satisfied_by?, #to_h, unregister, 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
12
13
14
|
# File 'lib/sof/cycles/within.rb', line 12
def self.description
"Within - occurrences within a time period from a specific date"
end
|
.dormant_capable? ⇒ Boolean
10
|
# File 'lib/sof/cycles/within.rb', line 10
def self.dormant_capable? = true
|
.examples ⇒ Object
16
17
18
|
# File 'lib/sof/cycles/within.rb', line 16
def self.examples
["V2W3DF2024-01-01 - twice within 3 days from Jan 1, 2024"]
end
|
.recurring? ⇒ Boolean
8
|
# File 'lib/sof/cycles/within.rb', line 8
def self.recurring? = false
|
Instance Method Details
#date_range ⇒ Object
30
31
32
33
34
|
# File 'lib/sof/cycles/within.rb', line 30
def date_range
return humanized_span unless active?
[start_date, final_date].map { it.to_fs(:american) }.join(" - ")
end
|
#extend_period(count) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/sof/cycles/within.rb', line 22
def extend_period(count)
Cycle.for(
Cycle::Parser.load(
parser.to_h.merge(period_count: period_count + count)
).to_s
)
end
|
#final_date(_ = nil) ⇒ Object
36
|
# File 'lib/sof/cycles/within.rb', line 36
def final_date(_ = nil) = time_span.end_date(start_date)
|
#start_date(_ = nil) ⇒ Object
38
|
# File 'lib/sof/cycles/within.rb', line 38
def start_date(_ = nil) = from_date.to_date
|
#to_s ⇒ Object
20
|
# File 'lib/sof/cycles/within.rb', line 20
def to_s = "#{volume}x within #{date_range}"
|