Class MCollective::Facts::Base
In: lib/mcollective/facts/base.rb
Parent: Object

A base class for fact providers, to make a new fully functional fact provider inherit from this and simply provide a self.get_facts method that returns a hash like:

 {"foo" => "bar",
  "bar" => "baz"}

Methods

Public Class methods

Registers new fact sources into the plugin manager

[Source]

    # File lib/mcollective/facts/base.rb, line 11
11:             def self.inherited(klass)
12:                 PluginManager << {:type => "facts_plugin", :class => klass.to_s}
13:             end

Public Instance methods

Returns the value of a single fact

[Source]

    # File lib/mcollective/facts/base.rb, line 16
16:             def get_fact(fact)
17:                 facts = get_facts
18: 
19:                 facts.include?(fact) ? facts[fact] : nil
20:             end

Returns true if we know about a specific fact, false otherwise

[Source]

    # File lib/mcollective/facts/base.rb, line 23
23:             def has_fact?(fact)
24:                 facts = get_facts
25: 
26:                 facts.include?(fact)
27:             end

[Validate]