class Puppet::Util::IniConfig::File

Attributes

files[R]

Public Class Methods

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

Public Instance Methods

[](name)
Alias for: get_section
add_section(name, file) click to toggle source
    # File lib/puppet/util/inifile.rb
312 def add_section(name, file)
313   get_physical_file(file).add_section(name)
314 end
each_file() { |path| ... } click to toggle source
    # File lib/puppet/util/inifile.rb
291 def each_file(&block)
292   @files.keys.each do |path|
293     yield path
294   end
295 end
each_section() { |section| ... } click to toggle source
    # File lib/puppet/util/inifile.rb
283 def each_section(&block)
284   @files.values.each do |file|
285     file.sections.each do |section|
286       yield section
287     end
288   end
289 end
get_section(name) click to toggle source
    # File lib/puppet/util/inifile.rb
297 def get_section(name)
298   sect = nil
299   @files.values.each do |file|
300     if (current = file.get_section(name))
301       sect = current
302     end
303   end
304   sect
305 end
Also aliased as: []
include?(name) click to toggle source
    # File lib/puppet/util/inifile.rb
308 def include?(name)
309   !! get_section(name)
310 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
273 def read(file)
274   new_physical_file(file).read
275 end
store() click to toggle source
    # File lib/puppet/util/inifile.rb
277 def store
278   @files.values.each do |file|
279     file.store
280   end
281 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
320 def get_physical_file(file)
321   if @files[file]
322     @files[file]
323   else
324     new_physical_file(file)
325   end
326 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
329 def new_physical_file(file)
330   @files[file] = PhysicalFile.new(file)
331   @files[file].file_collection = self
332   @files[file]
333 end