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.
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
#cron ⇒ Object (readonly)
Returns the value of attribute cron.
330 331 332 |
# File 'lib/fugit/cron.rb', line 330 def cron @cron end |
#current ⇒ Object (readonly)
Returns the value of attribute current.
330 331 332 |
# File 'lib/fugit/cron.rb', line 330 def current @current end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
330 331 332 |
# File 'lib/fugit/cron.rb', line 330 def direction @direction end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
330 331 332 |
# File 'lib/fugit/cron.rb', line 330 def start @start end |
Instance Method Details
#each ⇒ Object
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 |