class Fugit::Cron::TimeCursor
Public Class Methods
new(cron, t)
click to toggle source
# File lib/fugit/cron.rb, line 70 def initialize(cron, t) @cron = cron @t = t.is_a?(TimeCursor) ? t.time : t @t.seconds = @t.seconds.to_i end
Public Instance Methods
dec(i)
click to toggle source
# File lib/fugit/cron.rb, line 83 def dec(i); inc(-i); end
dec_day()
click to toggle source
# File lib/fugit/cron.rb, line 132 def dec_day dec(@t.hour * 3600 + @t.min * 60 + @t.sec + 1) end
dec_hour()
click to toggle source
# File lib/fugit/cron.rb, line 135 def dec_hour dec(@t.min * 60 + @t.sec + 1) end
dec_min()
click to toggle source
# File lib/fugit/cron.rb, line 138 def dec_min dec(@t.sec + 1) end
dec_month()
click to toggle source
# File lib/fugit/cron.rb, line 128 def dec_month dec((@t.day - 1) * DAY_S + @t.hour * 3600 + @t.min * 60 + @t.sec + 1) end
dec_sec()
click to toggle source
# File lib/fugit/cron.rb, line 142 def dec_sec target = @cron.seconds.reverse.find { |s| s < @t.sec } || @cron.seconds.last inc(target - @t.sec - (@t.sec > target ? 0 : 60)) end
inc(i)
click to toggle source
# File lib/fugit/cron.rb, line 82 def inc(i); @t = @t + i; self; end
inc_day()
click to toggle source
# File lib/fugit/cron.rb, line 96 def inc_day inc((24 - @t.hour) * 3600 - @t.min * 60 - @t.sec) #inc( - @t.hour * 3600) if @t.hour != 0 # compensate for entering DST #inc( - @t.hour * 3600) if @t.hour > 0 && @t.hour < 7 # leads to gh-60... if @t.hour == 0 # it's good, carry on... elsif @t.hour < 12 @t = ::EtOrbi.make(@t.year, @t.month, @t.day, @t.zone) else inc((24 - @t.hour) * 3600) end end
inc_hour()
click to toggle source
# File lib/fugit/cron.rb, line 113 def inc_hour inc((60 - @t.min) * 60 - @t.sec) end
inc_min()
click to toggle source
# File lib/fugit/cron.rb, line 116 def inc_min inc(60 - @t.sec) end
inc_month()
click to toggle source
# File lib/fugit/cron.rb, line 85 def inc_month y = @t.year m = @t.month + 1 if m == 13; m = 1; y += 1; end @t = ::EtOrbi.make(y, m, @t.zone) self end
inc_sec()
click to toggle source
# File lib/fugit/cron.rb, line 120 def inc_sec if sec = @cron.seconds.find { |s| s > @t.sec } inc(sec - @t.sec) else inc(60 - @t.sec + @cron.seconds.first) end end
time()
click to toggle source
# File lib/fugit/cron.rb, line 76 def time; @t; end
to_i()
click to toggle source
# File lib/fugit/cron.rb, line 77 def to_i; @t.to_i; end