Class: Pipely::PipelineDateTime::PipelineMonthRange
- Inherits:
-
PipelineDateRangeBase
- Object
- PipelineDateRangeBase
- Pipely::PipelineDateTime::PipelineMonthRange
- Defined in:
- lib/pipely/pipeline_date_time/pipeline_month_range.rb
Overview
Class that represents a range of individual pipeline months
Constant Summary collapse
- MINIMUM_MONTH_OFFSET =
The month of x+/-30 will never add extra days
30- MONTH_INTERVAL =
We never miss a month by taking every 28 days
28
Instance Attribute Summary collapse
-
#end ⇒ Object
readonly
Returns the value of attribute end.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Attributes inherited from PipelineDateRangeBase
Instance Method Summary collapse
-
#initialize(target_date, days_back_start, days_back_end) ⇒ PipelineMonthRange
constructor
A new instance of PipelineMonthRange.
- #months ⇒ Object
Methods inherited from PipelineDateRangeBase
Constructor Details
#initialize(target_date, days_back_start, days_back_end) ⇒ PipelineMonthRange
Returns a new instance of PipelineMonthRange.
14 15 16 17 18 19 |
# File 'lib/pipely/pipeline_date_time/pipeline_month_range.rb', line 14 def initialize(target_date, days_back_start, days_back_end) @target_date = target_date @start = days_back_start - MINIMUM_MONTH_OFFSET @end = days_back_end + MINIMUM_MONTH_OFFSET @days_back = (@end..@start).step(MONTH_INTERVAL).to_set end |
Instance Attribute Details
#end ⇒ Object (readonly)
Returns the value of attribute end.
12 13 14 |
# File 'lib/pipely/pipeline_date_time/pipeline_month_range.rb', line 12 def end @end end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
12 13 14 |
# File 'lib/pipely/pipeline_date_time/pipeline_month_range.rb', line 12 def start @start end |
Instance Method Details
#months ⇒ Object
21 22 23 |
# File 'lib/pipely/pipeline_date_time/pipeline_month_range.rb', line 21 def months @months ||= pipeline_dates.map { |pd| pd.month } end |