Class: VagrantPlugins::KeyManager::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::KeyManager::Config
- Defined in:
- lib/vagrant-keymanager/config.rb
Instance Attribute Summary collapse
-
#extra_params ⇒ Object
Returns the value of attribute extra_params.
-
#extra_steps ⇒ Object
Returns the value of attribute extra_steps.
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.
7 8 9 10 11 |
# File 'lib/vagrant-keymanager/config.rb', line 7 def initialize @extra_params = [] @extra_params = Array.new @extra_steps = nil end |
Instance Attribute Details
#extra_params ⇒ Object
Returns the value of attribute extra_params.
4 5 6 |
# File 'lib/vagrant-keymanager/config.rb', line 4 def extra_params @extra_params end |
#extra_steps ⇒ Object
Returns the value of attribute extra_steps.
5 6 7 |
# File 'lib/vagrant-keymanager/config.rb', line 5 def extra_steps @extra_steps end |
Instance Method Details
#finalize! ⇒ Object
13 14 15 |
# File 'lib/vagrant-keymanager/config.rb', line 13 def finalize! @extra_params = [ @extra_params ].flatten end |
#validate(machine) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vagrant-keymanager/config.rb', line 17 def validate(machine) errors = [] # errors << validate_bool('keymanager.enabled', @enabled) errors.compact! # check if extra_params option is an Array if !machine.config.keymanager.extra_params.kind_of?(Array) && !machine.config.keymanager.extra_params.kind_of?(String) errors << I18n.t('vagrant_keymanager.config.not_an_array_or_string', { :config_key => 'keymanager.extra_params', :is_class => extra_params.class.to_s, }) end if !machine.config.keymanager.extra_steps.nil? && !machine.config.keymanager.extra_steps.kind_of?(Proc) errors << I18n.t('vagrant_keymanager.config.not_a_proc', { :config_key => 'keymanager.extra_steps', :is_class => extra_steps.class.to_s, }) end errors.compact! { "KeyManager configuration" => errors } end |