Class: VagrantPlugins::MultiHostManager::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::MultiHostManager::Config
- Defined in:
- lib/vagrant-multihostmanager/config.rb
Instance Attribute Summary collapse
-
#aliases ⇒ Object
Returns the value of attribute aliases.
-
#enabled ⇒ Object
(also: #enabled?)
Returns the value of attribute enabled.
-
#ignore_private_ip ⇒ Object
Returns the value of attribute ignore_private_ip.
-
#include_offline ⇒ Object
(also: #include_offline?)
Returns the value of attribute include_offline.
-
#ip_resolver ⇒ Object
Returns the value of attribute ip_resolver.
-
#manage_host ⇒ Object
(also: #manage_host?)
Returns the value of attribute manage_host.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vagrant-multihostmanager/config.rb', line 15 def initialize @enabled = false @manage_host = UNSET_VALUE @ignore_private_ip = UNSET_VALUE @include_offline = UNSET_VALUE @aliases = [] @aliases = Array.new @include_offline = false @ip_resolver = nil end |
Instance Attribute Details
#aliases ⇒ Object
Returns the value of attribute aliases.
7 8 9 |
# File 'lib/vagrant-multihostmanager/config.rb', line 7 def aliases @aliases end |
#enabled ⇒ Object Also known as: enabled?
Returns the value of attribute enabled.
4 5 6 |
# File 'lib/vagrant-multihostmanager/config.rb', line 4 def enabled @enabled end |
#ignore_private_ip ⇒ Object
Returns the value of attribute ignore_private_ip.
6 7 8 |
# File 'lib/vagrant-multihostmanager/config.rb', line 6 def ignore_private_ip @ignore_private_ip end |
#include_offline ⇒ Object Also known as: include_offline?
Returns the value of attribute include_offline.
8 9 10 |
# File 'lib/vagrant-multihostmanager/config.rb', line 8 def include_offline @include_offline end |
#ip_resolver ⇒ Object
Returns the value of attribute ip_resolver.
9 10 11 |
# File 'lib/vagrant-multihostmanager/config.rb', line 9 def ip_resolver @ip_resolver end |
#manage_host ⇒ Object Also known as: manage_host?
Returns the value of attribute manage_host.
5 6 7 |
# File 'lib/vagrant-multihostmanager/config.rb', line 5 def manage_host @manage_host end |
Instance Method Details
#finalize! ⇒ Object
26 27 28 29 30 31 |
# File 'lib/vagrant-multihostmanager/config.rb', line 26 def finalize! @manage_host = false if @manage_host == UNSET_VALUE @ignore_private_ip = false if @ignore_private_ip == UNSET_VALUE @include_offline = false if @include_offline == UNSET_VALUE @aliases = [ @aliases ].flatten end |
#validate(machine) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/vagrant-multihostmanager/config.rb', line 33 def validate(machine) errors = [] errors << validate_bool('multihostmanager.enabled', @enabled) errors << validate_bool('multihostmanager.manage_host', @manage_host) errors << validate_bool('multihostmanager.ignore_private_ip', @ignore_private_ip) errors << validate_bool('multihostmanager.include_offline', @include_offline) errors.compact! # check if aliases option is an Array if !machine.config.multihostmanager.aliases.kind_of?(Array) && !machine.config.multihostmanager.aliases.kind_of?(String) errors << I18n.t('vagrant_hostmanager.config.not_an_array_or_string', { :config_key => 'multihostmanager.aliases', :is_class => aliases.class.to_s, }) end if !machine.config.multihostmanager.ip_resolver.nil? && !machine.config.multihostmanager.ip_resolver.kind_of?(Proc) errors << I18n.t('vagrant_hostmanager.config.not_a_proc', { :config_key => 'multihostmanager.ip_resolver', :is_class => ip_resolver.class.to_s, }) end errors.compact! { "MultiHostManager configuration" => errors } end |