Class: Async::Cron::Monthday

Inherits:
Period
  • Object
show all
Defined in:
lib/async/cron/period.rb

Constant Summary

Constants inherited from Period

Period::RANGE

Instance Method Summary collapse

Methods inherited from Period

#include?, #initialize, parse, #step, #to_a

Constructor Details

This class inherits a constructor from Async::Cron::Period

Instance Method Details

#increment(time) ⇒ Object



211
212
213
214
215
216
217
218
219
220
221
# File 'lib/async/cron/period.rb', line 211

def increment(time)
  current_time = time.dup
  monthday = @successors[time.days] || @values.first
  
  time.monthday = monthday
  
  while time <= current_time
    time.months += 1
    time.monthday = monthday
  end
end

#reset(time) ⇒ Object



223
224
225
226
227
228
229
# File 'lib/async/cron/period.rb', line 223

def reset(time)
  if @values&.any?
    time.monthday = @values.first
  else
    time.monthday = 0
  end
end

#value_from(time) ⇒ Object



231
232
233
# File 'lib/async/cron/period.rb', line 231

def value_from(time)
  time.days
end