Sha256: f8d8aaa3e9e18bd333702cdeb5004e4c73a7700940f97c47c5079c186aa6a6b6

Contents?: true

Size: 798 Bytes

Versions: 9

Compression:

Stored size: 798 Bytes

Contents

module CassetteRack
  module Tree
    class Branch < CassetteRack::Tree::Leaf
      attr_reader :entries

      def initialize(path, level=0, trunk=nil)
        super
        @entries = []
        node
      end

      def leaf?
        false
      end

      def each(&block)
        entries.each do |entry|
          block.call(entry)
          entry.each(&block) if entry.is_a?(CassetteRack::Tree::Branch)
        end
      end

      private
        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
      # end private
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cassette-rack-0.10.0 lib/cassette-rack/tree/branch.rb
cassette-rack-0.9.0 lib/cassette-rack/tree/branch.rb
cassette-rack-0.8.1 lib/cassette-rack/tree/branch.rb
cassette-rack-0.8.0 lib/cassette-rack/tree/branch.rb
cassette-rack-0.7.0 lib/cassette-rack/tree/branch.rb
cassette-rack-0.6.0 lib/cassette-rack/tree/branch.rb
cassette-rack-0.5.0 lib/cassette-rack/tree/branch.rb
cassette-rack-0.4.1 lib/cassette-rack/tree/branch.rb
cassette-rack-0.4.0 lib/cassette-rack/tree/branch.rb