Class: Fugit::Cron::CronIterator

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/fugit/cron.rb

Overview

Used by Fugit::Cron#next and Fugit::Cron#prev

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cron, direction, start) ⇒ CronIterator

Returns a new instance of CronIterator.



332
333
334
335
336
337
338
# File 'lib/fugit/cron.rb', line 332

def initialize(cron, direction, start)

  @cron = cron
  @start = start
  @current = start.dup
  @direction = direction
end

Instance Attribute Details

#cronObject (readonly)

Returns the value of attribute cron.



330
331
332
# File 'lib/fugit/cron.rb', line 330

def cron
  @cron
end

#currentObject (readonly)

Returns the value of attribute current.



330
331
332
# File 'lib/fugit/cron.rb', line 330

def current
  @current
end

#directionObject (readonly)

Returns the value of attribute direction.



330
331
332
# File 'lib/fugit/cron.rb', line 330

def direction
  @direction
end

#startObject (readonly)

Returns the value of attribute start.



330
331
332
# File 'lib/fugit/cron.rb', line 330

def start
  @start
end

Instance Method Details

#eachObject



340
341
342
343
344
345
346
# File 'lib/fugit/cron.rb', line 340

def each

  loop do

    yield(@current = @cron.send(@direction, @current))
  end
end