Class: DownloadConfig
- Inherits:
-
Object
- Object
- DownloadConfig
- Defined in:
- lib/jirametrics/download_config.rb
Instance Attribute Summary collapse
-
#project_config ⇒ Object
readonly
Returns the value of attribute project_config.
Instance Method Summary collapse
- #github_repo(*repos) ⇒ Object
- #github_repos ⇒ Object
-
#initialize(project_config:, block:) ⇒ DownloadConfig
constructor
A new instance of DownloadConfig.
- #no_earlier_than(date = :not_set) ⇒ Object
- #rolling_date_count(count = nil) ⇒ Object
- #run ⇒ Object
- #start_date(today:) ⇒ Object
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_config ⇒ Object (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
#github_repo(*repos) ⇒ Object
32 33 34 |
# File 'lib/jirametrics/download_config.rb', line 32 def github_repo *repos github_repos.concat(repos.map { |r| normalize_github_repo(r) }) end |
#github_repos ⇒ Object
28 29 30 |
# File 'lib/jirametrics/download_config.rb', line 28 def github_repos @github_repos ||= [] end |
#no_earlier_than(date = :not_set) ⇒ Object
23 24 25 26 |
# File 'lib/jirametrics/download_config.rb', line 23 def no_earlier_than date = :not_set @no_earlier_than = Date.parse(date) unless date == :not_set @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 |
#run ⇒ Object
14 15 16 |
# File 'lib/jirametrics/download_config.rb', line 14 def run instance_eval(&@block) end |
#start_date(today:) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/jirametrics/download_config.rb', line 36 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 |