Class: DownloadConfig

Inherits:
Object show all
Defined in:
lib/jirametrics/download_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_config:, block:) ⇒ DownloadConfig

Returns a new instance of DownloadConfig.



8
9
10
11
12
# File 'lib/jirametrics/download_config.rb', line 8

def initialize project_config:, block:
  @project_config = project_config
  @block = block
  @board_ids = []
end

Instance Attribute Details

#project_configObject (readonly)

Returns the value of attribute project_config.



6
7
8
# File 'lib/jirametrics/download_config.rb', line 6

def project_config
  @project_config
end

Instance Method Details

#no_earlier_than(date = nil) ⇒ Object



23
24
25
26
# File 'lib/jirametrics/download_config.rb', line 23

def no_earlier_than date = nil
  @no_earlier_than = Date.parse(date) unless date.nil?
  @no_earlier_than
end

#rolling_date_count(count = nil) ⇒ Object



18
19
20
21
# File 'lib/jirametrics/download_config.rb', line 18

def rolling_date_count count = nil
  @rolling_date_count = count unless count.nil?
  @rolling_date_count
end

#runObject



14
15
16
# File 'lib/jirametrics/download_config.rb', line 14

def run
  instance_eval(&@block)
end

#start_date(today:) ⇒ Object



28
29
30
31
32
33
# File 'lib/jirametrics/download_config.rb', line 28

def start_date today:
  date = today.to_date - @rolling_date_count if @rolling_date_count
  date = [date, @no_earlier_than].max if date && @no_earlier_than
  date = @no_earlier_than if date.nil? && @no_earlier_than
  date
end