Module Puppet::Util::FileParsing
In: lib/puppet/util/fileparsing.rb

Methods

Included Modules

Puppet::Util

Classes and Modules

Class Puppet::Util::FileParsing::FileRecord

Attributes

line_separator  [W] 
trailing_separator  [W] 

Public Instance methods

Clear all existing record definitions. Only used for testing.

Try to match a record.

Try to match a specific text line.

Split text into separate lines using the record separator.

Split a bunch of text into lines and then parse them individually.

Handle parsing a single line.

Define a new type of record. These lines get split into hashes. Valid options are:

  • :absent: What to use as value within a line, when a field is absent. Note that in the record object, the literal :absent symbol is used, and not this value. Defaults to "".
  • :fields: The list of fields, as an array. By default, all fields are considered required.
  • :joiner: How to join fields together. Defaults to ’\t’.
  • :optional: Which fields are optional. If these are missing, you‘ll just get the ‘absent’ value instead of an ArgumentError.
  • :rts: Whether to remove trailing whitespace. Defaults to false. If true, whitespace will be removed; if a regex, then whatever matches the regex will be removed.
  • :separator: The record separator. Defaults to /\s+/.

Are there any record types defined?

Define a new type of text record.

Generate a file from a bunch of hash records.

Convert our parsed record into a text record.

Whether to add a trailing separator to the file. Defaults to true

[Validate]