Class: LegacyFacter::Util::Parser::YamlParser

Inherits:
Base
  • Object
show all
Defined in:
lib/facter/custom_facts/util/parser.rb

Instance Attribute Summary

Attributes inherited from Base

#filename

Instance Method Summary collapse

Methods inherited from Base

#content, #initialize, #log_stderr, #parse_executable_output, #results

Constructor Details

This class inherits a constructor from LegacyFacter::Util::Parser::Base

Instance Method Details

#parse_resultsObject



117
118
119
120
121
122
123
124
125
126
# File 'lib/facter/custom_facts/util/parser.rb', line 117

def parse_results
  # Add quotes to Yaml time
  cont = content.gsub(TIME, '"\1"')

  if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0') # Ruby 2.6+
    YAML.safe_load(cont, permitted_classes: [Date], aliases: true)
  else
    YAML.safe_load(cont, [Date], [], [], true)
  end
end