Class: LegacyFacter::Util::Parser::JsonParser

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, #parse_executable_output, #results

Constructor Details

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

Instance Method Details

#parse_resultsObject



125
126
127
128
129
130
131
132
133
# File 'lib/facter/custom_facts/util/parser.rb', line 125

def parse_results
  if LegacyFacter.json?
    JSON.parse(content)
  else
    LegacyFacter.warnonce "Cannot parse JSON data file #{filename} without the json library."
    LegacyFacter.warnonce 'Suggested next step is `gem install json` to install the json library.'
    nil
  end
end