Class: Vagrant::Config::Top

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

Constant Summary collapse

@@configures =
[]

Instance Attribute Summary

Attributes inherited from Base

#env

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #instance_variables_hash, #to_json

Constructor Details

#initialize(env = nil) ⇒ Top

Returns a new instance of Top.



163
164
165
166
167
168
169
170
171
172
# File 'lib/vagrant/config.rb', line 163

def initialize(env=nil)
  self.class.configures_list.each do |key, klass|
    config = klass.new
    config.env = env
    instance_variable_set("@#{key}".to_sym, config)
  end

  @loaded = false
  @env = env
end

Class Method Details

.configures(key, klass) ⇒ Object



151
152
153
154
# File 'lib/vagrant/config.rb', line 151

def configures(key, klass)
  configures_list << [key, klass]
  attr_reader key.to_sym
end

.configures_listObject



147
148
149
# File 'lib/vagrant/config.rb', line 147

def configures_list
  @@configures ||= []
end

Instance Method Details

#loaded!Object



178
179
180
# File 'lib/vagrant/config.rb', line 178

def loaded!
  @loaded = true
end

#loaded?Boolean

Returns:

  • (Boolean)


174
175
176
# File 'lib/vagrant/config.rb', line 174

def loaded?
  @loaded
end