module Lazily
def associate(source_map, &block)
-
(Enumerable)
- a lazy collection of Hashes
Parameters:
-
labelled_enumerables
(Hash
) --
def associate(source_map, &block) labels = source_map.keys tagged_element_sources = source_map.map do |label, enumerable| enumerable.lazily.map do |value| key = block ? block.call(value) : value TaggedElement.new(key, value, label) end end tagged_elements = Lazily.merge(*tagged_element_sources) { |te| te.key } tagged_elements.chunk { |te| te.key }.map do |_, tagged_elements| association = {} labels.each { |label| association[label] = [] } tagged_elements.each do |te| association[te.label] << te.value end association end end
def concat(*enumerables)
-
(Enumerable)
- elements of all the enumerables
Parameters:
-
enumerables
(Array
) --
def concat(*enumerables) Concatenator.new(enumerables) end
def dequeue(queue)
def dequeue(queue) Dequeuer.new(queue) end
def merge(*enumerables, &block)
-
(Enumerable)
- merged, sorted elements
Parameters:
-
enumerables
(Array
) --
def merge(*enumerables, &block) Merger.new(enumerables, &block) end
def zip(*enumerables)
def zip(*enumerables) Zipper.new(enumerables) end