Method: MetalArchives::Collection#each

Defined in:
lib/metal_archives/collection.rb

#each(&block) ⇒ Object

Calls the given block once for each element, passing that element as a parameter. If no block is given, an Enumerator is returned.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/metal_archives/collection.rb', line 25

def each(&block)
  return to_enum :each unless block

  loop do
    items = instance_exec(&@proc)

    items.each(&block)

    break if items.empty?
  end
end