Method: Gemlist::SpecNode#each

Defined in:
lib/gemlist/spec_node.rb

#each(&block) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/gemlist/spec_node.rb', line 21

def each(&block)
  return to_enum unless block_given?

  unvisited = [self]

  until unvisited.empty?
    current = unvisited.shift

    if current
      yield current

      unvisited.unshift(*current.children)
    end
  end

  return self if block_given?
end