Sha256: 6c3a139b01e4812155ee598b156087a6b2bb11aedc787039976e9e382876f3a6

Contents?: true

Size: 536 Bytes

Versions: 9

Compression:

Stored size: 536 Bytes

Contents

module CassetteRack
  module Tree
    class Leaf
      attr_reader :name, :path, :level, :trunk, :id

      def initialize(path, level=0, trunk=nil)
        @name = File.basename(path, '.*')
        @path = File.expand_path(path)

        if trunk.nil?
          @level = level
          @trunk = path
          @id = :root
        else
          @level = level + 1
          @trunk = trunk
          @id = "#{File.dirname(@path)}/#{@name}".sub(trunk, '')
        end
      end

      def leaf?
        true
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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