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.
349 350 351 352 353 354 355 |
# File 'lib/fugit/cron.rb', line 349 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.
347 348 349 |
# File 'lib/fugit/cron.rb', line 347 def cron @cron end |
#current ⇒ Object (readonly)
Returns the value of attribute current.
347 348 349 |
# File 'lib/fugit/cron.rb', line 347 def current @current end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
347 348 349 |
# File 'lib/fugit/cron.rb', line 347 def direction @direction end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
347 348 349 |
# File 'lib/fugit/cron.rb', line 347 def start @start end |
Instance Method Details
#each ⇒ Object
357 358 359 360 361 362 363 |
# File 'lib/fugit/cron.rb', line 357 def each loop do yield(@current = @cron.send(@direction, @current)) end end |