Class: VagrantPlugins::PuppetFactGenerator::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::PuppetFactGenerator::Config
- Defined in:
- lib/vagrant-puppet-fact-generator/config.rb
Instance Attribute Summary collapse
-
#facts ⇒ Object
Returns the value of attribute facts.
Instance Method Summary collapse
- #add_fact(fact_name, value) ⇒ Object
- #finalize! ⇒ Object
- #get_facts ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
6 7 8 |
# File 'lib/vagrant-puppet-fact-generator/config.rb', line 6 def initialize @facts = UNSET_VALUE end |
Instance Attribute Details
#facts ⇒ Object
Returns the value of attribute facts.
4 5 6 |
# File 'lib/vagrant-puppet-fact-generator/config.rb', line 4 def facts @facts end |
Instance Method Details
#add_fact(fact_name, value) ⇒ Object
17 18 19 20 |
# File 'lib/vagrant-puppet-fact-generator/config.rb', line 17 def add_fact(fact_name, value) facts = get_facts() facts[fact_name] = value end |
#finalize! ⇒ Object
22 23 24 |
# File 'lib/vagrant-puppet-fact-generator/config.rb', line 22 def finalize! @facts = {} if @facts == UNSET_VALUE end |
#get_facts ⇒ Object
10 11 12 13 14 15 |
# File 'lib/vagrant-puppet-fact-generator/config.rb', line 10 def get_facts if @facts == UNSET_VALUE @facts = {} end return @facts end |
#validate(machine) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/vagrant-puppet-fact-generator/config.rb', line 26 def validate(machine) errors = [] if @facts and not @facts.kind_of?(Hash) errors << '`facts` must be a hash of form fact_name => fact_value' end return {'puppet_fact_generator' => errors} end |