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.



345
346
347
348
349
350
351
# File 'lib/fugit/cron.rb', line 345

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.



343
344
345
# File 'lib/fugit/cron.rb', line 343

def cron
  @cron
end

#currentObject (readonly)

Returns the value of attribute current.



343
344
345
# File 'lib/fugit/cron.rb', line 343

def current
  @current
end

#directionObject (readonly)

Returns the value of attribute direction.



343
344
345
# File 'lib/fugit/cron.rb', line 343

def direction
  @direction
end

#startObject (readonly)

Returns the value of attribute start.



343
344
345
# File 'lib/fugit/cron.rb', line 343

def start
  @start
end

Instance Method Details

#eachObject



353
354
355
356
357
358
359
# File 'lib/fugit/cron.rb', line 353

def each

  loop do

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