Class: Facter::Util::Parser::JsonParser

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

Instance Attribute Summary

Attributes inherited from Base

#filename

Instance Method Summary collapse

Methods inherited from Base

#content, #initialize, #results

Constructor Details

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

Instance Method Details

#parse_resultsObject



103
104
105
106
107
108
109
110
111
# File 'lib/facter/util/parser.rb', line 103

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