Class: Bonito::ParallelScheduler

Inherits:
Scheduler show all
Defined in:
lib/bonito/parallel_timeline.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(parallel, starting_offset, scope, opts = {}) ⇒ ParallelScheduler

Returns a new instance of ParallelScheduler.



9
10
11
12
13
14
15
# File 'lib/bonito/parallel_timeline.rb', line 9

def initialize(parallel, starting_offset, scope, opts = {})
  super
  @schedulers = parallel.map do |timeline|
    timeline.schedule(starting_offset, scope, opts).to_enum
  end
  @heap = LazyMinHeap.new(*@schedulers)
end

Instance Method Details

#eachObject



17
18
19
# File 'lib/bonito/parallel_timeline.rb', line 17

def each
  @heap.each { |moment| yield moment }
end