Sha256: deef3e028bd35adea933a9bb0bb2d94b790e97c7d37e8b83d3232e5edb5a447c

Contents?: true

Size: 522 Bytes

Versions: 46

Compression:

Stored size: 522 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

46 entries across 46 versions & 3 rubygems

Version Path
puppet-2.6.18 lib/puppet/file_collection.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/lib/puppet/file_collection.rb
puppet-2.7.19 lib/puppet/file_collection.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/file_collection.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/lib/puppet/file_collection.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/file_collection.rb
puppet-2.7.18 lib/puppet/file_collection.rb
puppet-2.6.17 lib/puppet/file_collection.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/file_collection.rb
supply_drop-0.10.0 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/file_collection.rb
puppet-2.7.17 lib/puppet/file_collection.rb
puppet-2.7.16 lib/puppet/file_collection.rb
puppet-2.7.14 lib/puppet/file_collection.rb
puppet-2.6.16 lib/puppet/file_collection.rb
puppet-2.7.13 lib/puppet/file_collection.rb
puppet-2.6.15 lib/puppet/file_collection.rb
supply_drop-0.9.0 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/file_collection.rb
supply_drop-0.8.1 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/file_collection.rb
supply_drop-0.8.0 examples/vendored-puppet/vendor/puppet-2.7.8/lib/puppet/file_collection.rb
puppet-2.7.12 lib/puppet/file_collection.rb