Module: SlowEnumeratorTools::Merger

Defined in:
lib/slow_enumerator_tools/merger.rb

Defined Under Namespace

Classes: Iterator

Class Method Summary collapse

Class Method Details

.merge(enums) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/slow_enumerator_tools/merger.rb', line 5

def self.merge(enums)
  enum = Iterator.new(enums).tap(&:start)

  Enumerator.new do |y|
    loop { y << enum.next }
  end.lazy
end