Class: VagrantHosts::ConfigBuilder::Model
- Inherits:
-
ConfigBuilder::Model::Base
- Object
- ConfigBuilder::Model::Base
- VagrantHosts::ConfigBuilder::Model
- Defined in:
- lib/vagrant-hosts/config_builder.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Model
constructor
A new instance of Model.
- #to_proc ⇒ Object
Constructor Details
#initialize ⇒ Model
Returns a new instance of Model.
14 15 16 |
# File 'lib/vagrant-hosts/config_builder.rb', line 14 def initialize @hosts = [] end |
Instance Attribute Details
#add_localhost_hostnames ⇒ Object
12 13 14 |
# File 'lib/vagrant-hosts/config_builder.rb', line 12 def add_localhost_hostnames @add_localhost_hostnames end |
#autoconfigure ⇒ Object
10 11 12 |
# File 'lib/vagrant-hosts/config_builder.rb', line 10 def autoconfigure @autoconfigure end |
#hosts ⇒ Object
8 9 10 |
# File 'lib/vagrant-hosts/config_builder.rb', line 8 def hosts @hosts end |
Instance Method Details
#to_proc ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vagrant-hosts/config_builder.rb', line 18 def to_proc Proc.new do |vm_config| vm_config.provision :hosts do |h_config| h_config.autoconfigure = attr(:autoconfigure) unless attr(:autoconfigure).nil? h_config.add_localhost_hostnames = attr(:add_localhost_hostnames) unless attr(:add_localhost_hostnames).nil? @hosts.each do |(address, aliases)| h_config.add_host address, aliases end end end end |