diff options
Diffstat (limited to 'lib/puppet/file_collection/lookup.rb')
-rw-r--r-- | lib/puppet/file_collection/lookup.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/puppet/file_collection/lookup.rb b/lib/puppet/file_collection/lookup.rb new file mode 100644 index 000000000..ddb0c8431 --- /dev/null +++ b/lib/puppet/file_collection/lookup.rb @@ -0,0 +1,20 @@ +require 'puppet/file_collection' + +# A simple module for looking up file paths and indexes +# in a file collection. +module Puppet::FileCollection::Lookup + attr_accessor :line, :file_index + + def file_collection + Puppet::FileCollection.collection + end + + def file=(path) + @file_index = file_collection.index(path) + end + + def file + return nil unless file_index + file_collection.path(file_index) + end +end |