summaryrefslogtreecommitdiffstats
path: root/lib/puppet/file_collection/lookup.rb
blob: 30679480d1d5dd5db6478ddad7610b6c8915ef3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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