diff options
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/file_collection.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/puppet/file_collection.rb b/lib/puppet/file_collection.rb index 69f59ffdf..7db2600c0 100644 --- a/lib/puppet/file_collection.rb +++ b/lib/puppet/file_collection.rb @@ -9,14 +9,16 @@ class Puppet::FileCollection def initialize @paths = [] + @inverse = {} end def index(path) - if @paths.include?(path) - return @paths.index(path) + if i = @inverse[path] + return i else @paths << path - return @paths.length - 1 + i = @inverse[path] = @paths.length - 1 + return i end end |
