class Puppet::Util::IniConfig::FileCollection

Attributes

files[R]

Public Class Methods

new() click to toggle source
    # File lib/puppet/util/inifile.rb
266 def initialize
267   @files = {}
268 end

Public Instance Methods

[](name)
Alias for: get_section
add_section(name, file) click to toggle source
    # File lib/puppet/util/inifile.rb
311 def add_section(name, file)
312   get_physical_file(file).add_section(name)
313 end
each_file() { |path| ... } click to toggle source
    # File lib/puppet/util/inifile.rb
290 def each_file(&block)
291   @files.keys.each do |path|
292     yield path
293   end
294 end
each_section() { |section| ... } click to toggle source
    # File lib/puppet/util/inifile.rb
282 def each_section(&block)
283   @files.values.each do |file|
284     file.sections.each do |section|
285       yield section
286     end
287   end
288 end
get_section(name) click to toggle source
    # File lib/puppet/util/inifile.rb
296 def get_section(name)
297   sect = nil
298   @files.values.each do |file|
299     if (current = file.get_section(name))
300       sect = current
301     end
302   end
303   sect
304 end
Also aliased as: []
include?(name) click to toggle source
    # File lib/puppet/util/inifile.rb
307 def include?(name)
308   !! get_section(name)
309 end
read(file) click to toggle source

Read and parse a file and store it in the collection. If the file has already been read it will be destroyed and re-read.

    # File lib/puppet/util/inifile.rb
272 def read(file)
273   new_physical_file(file).read
274 end
store() click to toggle source
    # File lib/puppet/util/inifile.rb
276 def store
277   @files.values.each do |file|
278     file.store
279   end
280 end

Private Instance Methods

get_physical_file(file) click to toggle source

Return a file if it's already been defined, create a new file if it hasn't been defined.

    # File lib/puppet/util/inifile.rb
319 def get_physical_file(file)
320   if @files[file]
321     @files[file]
322   else
323     new_physical_file(file)
324   end
325 end
new_physical_file(file) click to toggle source

Create a new physical file and set required attributes on that file.

    # File lib/puppet/util/inifile.rb
328 def new_physical_file(file)
329   @files[file] = PhysicalFile.new(file)
330   @files[file].file_collection = self
331   @files[file]
332 end