Sha256: e59d1fc90f04b3d1682a591ac3740c6e824f23e3703e24241156f016d3ef5f63

Contents?: true

Size: 594 Bytes

Versions: 8

Compression:

Stored size: 594 Bytes

Contents

# A simple way to turn file names into singletons,
# so we don't have tons of copies of each file path around.
class Puppet::FileCollection
    require 'puppet/file_collection/lookup'

    def self.collection
        @collection
    end

    def initialize
        @paths = []
        @inverse = {}
    end

    def index(path)
        if i = @inverse[path]
            return i
        else
            @paths << path
            i = @inverse[path] = @paths.length - 1
            return i
        end
    end

    def path(index)
        @paths[index]
    end

    @collection = self.new
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
puppet-0.25.5 lib/puppet/file_collection.rb
puppet-0.25.4 lib/puppet/file_collection.rb
puppet-0.25.3 lib/puppet/file_collection.rb
puppet-0.24.9 lib/puppet/file_collection.rb
puppet-0.25.2 lib/puppet/file_collection.rb
puppet-0.25.1 lib/puppet/file_collection.rb
puppet-0.25.0 lib/puppet/file_collection.rb
puppet-0.24.8 lib/puppet/file_collection.rb