Ohai::Hints

Public Class Methods

hint?(name) click to toggle source
# File lib/ohai/hints.rb, line 26
def self.hint?(name)
  @hints ||= Hash.new
  return @hints[name] if @hints[name]

  Ohai::Config[:hints_path].each do |path|
    filename = File.join(path, "#{name}.json")
    if File.exist?(filename)
      begin
        json_parser = Yajl::Parser.new
        hash = json_parser.parse(File.read(filename))
        @hints[name] = hash || Hash.new # hint
        # should exist because the file did, even if it didn't
        # contain anything
      rescue Yajl::ParseError => e
        Ohai::Log.error("Could not parse hint file at #{filename}: #{e.message}")
      end
    end
  end

  @hints[name]
end
refresh_hints() click to toggle source
# File lib/ohai/hints.rb, line 22
def self.refresh_hints
  @hints = Hash.new
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.