class CassetteRack::Tree::Branch

Attributes

entries[R]

Public Class Methods

new(path, level=0, trunk=nil) click to toggle source
Calls superclass method CassetteRack::Tree::Leaf::new
# File lib/cassette-rack/tree/branch.rb, line 6
def initialize(path, level=0, trunk=nil)
  super
  @entries = []
  node
end

Public Instance Methods

each(&block) click to toggle source
# File lib/cassette-rack/tree/branch.rb, line 16
def each(&block)
  entries.each do |entry|
    block.call(entry)
    entry.each(&block) if entry.is_a?(CassetteRack::Tree::Branch)
  end
end
leaf?() click to toggle source
# File lib/cassette-rack/tree/branch.rb, line 12
def leaf?
  false
end

Private Instance Methods

node() click to toggle source
# File lib/cassette-rack/tree/branch.rb, line 24
def node
  Dir[File.join(path, '*')].each do |path|
    if File.directory?(path)
      entries << CassetteRack::Tree::Branch.new(path, level, trunk)
    else
      entries << CassetteRack::Tree::Leaf.new(path, level, trunk)
    end
  end
end