Ruby/Development/SyncEnumerator
Материал из Wiki.crossplatform.ru
Looping Through Multiple Iterables in Parallel
require "generator" enumerator = SyncEnumerator.new(%w{Four seven}, %w{score years}, %w{and ago}) enumerator.each do |row| row.each { |word| puts word } puts "---" end enumerator = SyncEnumerator.new(%w{Four and}, %w{score seven years ago}) enumerator.each do |row| row.each { |word| puts word } puts "---" end