Class: Vagrant::Config::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/config/container.rb

Overview

Contains loaded configuration values and provides access to those values.

This is the class returned when loading configuration and stores the completely loaded configuration values. This class is meant to be immutable.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(global, vms) ⇒ Container

Initializes the configuration container.

Parameters:

  • global (Top)

    Top-level configuration for the global applicatoin.

  • vms (Array)

    Array of VM configurations.



18
19
20
21
22
23
24
25
26
27
# File 'lib/vagrant/config/container.rb', line 18

def initialize(global, vms)
  @global = global
  @vms    = []
  @vm_configs = {}

  vms.each do |vm_config|
    @vms << vm_config.vm.name
    @vm_configs[vm_config.vm.name] = vm_config
  end
end

Instance Attribute Details

#globalObject (readonly)

Returns the value of attribute global.



10
11
12
# File 'lib/vagrant/config/container.rb', line 10

def global
  @global
end

#vmsObject (readonly)

Returns the value of attribute vms.



11
12
13
# File 'lib/vagrant/config/container.rb', line 11

def vms
  @vms
end

Instance Method Details

#for_vm(name) ⇒ Object

This returns the configuration for a specific virtual machine. The values for this configuration are usually pertinent to a single virtual machine and do not affect the system globally.



32
33
34
# File 'lib/vagrant/config/container.rb', line 32

def for_vm(name)
  @vm_configs[name]
end