class Chef::Resource::OhaiHint

Public Instance Methods

format_content(content) click to toggle source

format content hash as JSON @param content [Hash] the content of the hint file @return [JSON] json representation of the content of an empty string if content was nil

# File lib/chef/resource/ohai_hint.rb, line 110
def format_content(content)
  return "" if content.nil? || content.empty?

  JSON.pretty_generate(content)
end
ohai_hint_file_path(filename) click to toggle source

given a hint filename return the platform specific hint file path @param filename [String] the name of the hint file @return [String] absolute path to the file

# File lib/chef/resource/ohai_hint.rb, line 101
def ohai_hint_file_path(filename)
  path = ::File.join(::Ohai::Config.ohai.hints_path.first, filename)
  path << ".json" unless path.end_with?(".json")
  path
end