Class: Pipely::Build::DailyScheduler
- Inherits:
-
Object
- Object
- Pipely::Build::DailyScheduler
- Defined in:
- lib/pipely/build/daily_scheduler.rb
Overview
Compute schedule attributes for a pipeline that runs once-a-day at a set time.
Instance Method Summary collapse
-
#initialize(start_time) ⇒ DailyScheduler
constructor
A new instance of DailyScheduler.
- #period ⇒ Object
- #start_date_time ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(start_time) ⇒ DailyScheduler
Returns a new instance of DailyScheduler.
9 10 11 |
# File 'lib/pipely/build/daily_scheduler.rb', line 9 def initialize(start_time) @start_time = start_time end |
Instance Method Details
#period ⇒ Object
13 14 15 |
# File 'lib/pipely/build/daily_scheduler.rb', line 13 def period '24 hours' end |
#start_date_time ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/pipely/build/daily_scheduler.rb', line 17 def start_date_time date = Date.today # if start_time already happened today, wait for tomorrow's start_time now_time = Time.now.utc.strftime('%H:%M:%S') date += 1 if now_time >= @start_time date.strftime("%Y-%m-%dT#{@start_time}") end |
#to_hash ⇒ Object
27 28 29 30 31 32 |
# File 'lib/pipely/build/daily_scheduler.rb', line 27 def to_hash { :period => period, :start_date_time => start_date_time } end |