class Pipely::Build::DailyScheduler
Compute schedule attributes for a pipeline that runs once-a-day at a set time.
Public Class Methods
new(start_time)
click to toggle source
# File lib/pipely/build/daily_scheduler.rb, line 9 def initialize(start_time) @start_time = DateTime.parse(start_time).strftime('%H:%M:%S') end
Public Instance Methods
period()
click to toggle source
# File lib/pipely/build/daily_scheduler.rb, line 13 def period '24 hours' end
start_date_time()
click to toggle source
# 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()
click to toggle source
# File lib/pipely/build/daily_scheduler.rb, line 27 def to_hash { :period => period, :start_date_time => start_date_time } end