Class: PuppetDB::Model::Fact
Overview
Parses fact_contents from PuppetDB
All attributes retreived from the puppetdb be added as getter to the object
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Fact
constructor
A new instance of Fact.
- #to_s ⇒ Object
-
#value ⇒ Object
gets the value for the fact and certname combination.
Methods inherited from Base
client, client=, get, query, request
Constructor Details
#initialize(attributes) ⇒ Fact
Returns a new instance of Fact.
9 10 11 12 |
# File 'lib/puppetdb/model/fact.rb', line 9 def initialize(attributes) super(**attributes) self.name = attributes[:name] end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/puppetdb/model/fact.rb', line 7 def name @name end |
Instance Method Details
#to_s ⇒ Object
30 31 32 |
# File 'lib/puppetdb/model/fact.rb', line 30 def to_s value end |
#value ⇒ Object
gets the value for the fact and certname combination
The value of value is lazy loaded on call and saved in the object
25 26 27 28 |
# File 'lib/puppetdb/model/fact.rb', line 25 def value pql = "fact_contents[value] { certname = '#{certname}' and path = #{@path}}" @value ||= self.class.request(pql).first.values end |