Module: FSSM::Tree::NodeEnumerable

Includes:
Enumerable, NodeBase
Included in:
Cache, Node
Defined in:
lib/fssm/tree.rb

Instance Method Summary collapse

Methods included from NodeBase

#initialize

Instance Method Details

#each(prefix = nil, &block) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/fssm/tree.rb', line 34

def each(prefix=nil, &block)
  @children.each do |segment, node|
    cprefix = prefix ? 
              FSSM::Pathname.for(prefix).join(segment) :
              FSSM::Pathname.for(segment)
    block.call(cprefix, node)
    node.each(cprefix, &block)
  end
end