| 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"}
Registers new fact sources into the plugin manager
# File lib/mcollective/facts/base.rb, line 11
11: def self.inherited(klass)
12: PluginManager << {:type => "facts_plugin", :class => klass.to_s}
13: end
Returns the value of a single fact
# 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