blob: a7bdd04a8dcbcab5c7574da2e7eeb0de286ff9ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# 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
|