Class: Vagrant::Dnsmasq::Config
Instance Attribute Summary collapse
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#enable ⇒ Object
(also: #enabled?)
Returns the value of attribute enable.
-
#ip ⇒ Object
Returns the value of attribute ip.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 16 17 18 19 |
# File 'lib/vagrant-dnsmasq/config.rb', line 11 def initialize inc_path = Pathname.new(File.("../includes", __FILE__)) require inc_path.join("Domain.class.rb") require inc_path.join("Ip.class.rb") @enable = UNSET_VALUE @domain = UNSET_VALUE @ip = UNSET_VALUE end |
Instance Attribute Details
#domain ⇒ Object
Returns the value of attribute domain.
6 7 8 |
# File 'lib/vagrant-dnsmasq/config.rb', line 6 def domain @domain end |
#enable ⇒ Object Also known as: enabled?
Returns the value of attribute enable.
5 6 7 |
# File 'lib/vagrant-dnsmasq/config.rb', line 5 def enable @enable end |
#ip ⇒ Object
Returns the value of attribute ip.
7 8 9 |
# File 'lib/vagrant-dnsmasq/config.rb', line 7 def ip @ip end |
Instance Method Details
#finalize! ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vagrant-dnsmasq/config.rb', line 21 def finalize! @enable = false if @enable == UNSET_VALUE @domain = nil if @domain == UNSET_VALUE @ip = nil if @ip == UNSET_VALUE # make it a Domain instance @domain = Domain.new @domain # make it an Ip instance @ip = [@ip] unless @ip.kind_of? Array @ip.map!{|ip| begin Ip.new(ip) rescue nil end}.compact! end |