Class: Fugit::Cron::CronIterator
- Inherits:
-
Object
- Object
- Fugit::Cron::CronIterator
- Includes:
- Enumerable
- Defined in:
- lib/fugit/cron.rb
Overview
Used by Fugit::Cron#next and Fugit::Cron#prev
Instance Attribute Summary collapse
-
#cron ⇒ Object
readonly
Returns the value of attribute cron.
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(cron, direction, start) ⇒ CronIterator
constructor
A new instance of CronIterator.
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
#cron ⇒ Object (readonly)
Returns the value of attribute cron.
343 344 345 |
# File 'lib/fugit/cron.rb', line 343 def cron @cron end |
#current ⇒ Object (readonly)
Returns the value of attribute current.
343 344 345 |
# File 'lib/fugit/cron.rb', line 343 def current @current end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
343 344 345 |
# File 'lib/fugit/cron.rb', line 343 def direction @direction end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
343 344 345 |
# File 'lib/fugit/cron.rb', line 343 def start @start end |
Instance Method Details
#each ⇒ Object
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 |