Class: VagrantPlugins::Dotvm::Config::Root
- Inherits:
-
AbstractConfig
- Object
- AbstractConfig
- VagrantPlugins::Dotvm::Config::Root
- Defined in:
- lib/vagrant-dotvm/config/root.rb
Instance Attribute Summary collapse
-
#machines ⇒ Object
readonly
Returns the value of attribute machines.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize ⇒ Root
constructor
A new instance of Root.
- #populate_machines(data) ⇒ Object
- #populate_options(data) ⇒ Object
Methods inherited from AbstractConfig
#populate, #replace_vars, #replace_vars!
Constructor Details
#initialize ⇒ Root
Returns a new instance of Root.
8 9 10 11 12 13 14 15 |
# File 'lib/vagrant-dotvm/config/root.rb', line 8 def initialize() @machines = [] = { :ssh => [], :winrm => [], :vagrant => [], } end |
Instance Attribute Details
#machines ⇒ Object (readonly)
Returns the value of attribute machines.
5 6 7 |
# File 'lib/vagrant-dotvm/config/root.rb', line 5 def machines @machines end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/vagrant-dotvm/config/root.rb', line 6 def end |
Instance Method Details
#populate_machines(data) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/vagrant-dotvm/config/root.rb', line 17 def populate_machines(data) raise "'machines' must be array." unless data.kind_of?(Array) || data.kind_of?(NilClass) data.to_a.each do |item| machine = Machine.new machine.populate item @machines << machine end end |
#populate_options(data) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vagrant-dotvm/config/root.rb', line 27 def (data) raise "'options' must be hash." unless data.kind_of?(Hash) || data.kind_of?(NilClass) data.to_h.each do |key, confs| key = key.to_sym raise "Invalid options category: #{key}." unless .has_key?(key) confs.to_a.each do |conf| item = Option.new item.populate conf [key] << item end end end |