Class: VagrantPlugins::Blocker::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Blocker::Config
- Defined in:
- lib/vagrant_blocker/config.rb
Overview
Configuration
Instance Attribute Summary collapse
-
#blocks ⇒ Object
Returns the value of attribute blocks.
-
#strict_config ⇒ Object
Returns the value of attribute strict_config.
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.
9 10 11 12 |
# File 'lib/vagrant_blocker/config.rb', line 9 def initialize @blocks = UNSET_VALUE @strict_config = UNSET_VALUE end |
Instance Attribute Details
#blocks ⇒ Object
Returns the value of attribute blocks.
6 7 8 |
# File 'lib/vagrant_blocker/config.rb', line 6 def blocks @blocks end |
#strict_config ⇒ Object
Returns the value of attribute strict_config.
7 8 9 |
# File 'lib/vagrant_blocker/config.rb', line 7 def strict_config @strict_config end |
Instance Method Details
#finalize! ⇒ Object
14 15 16 17 18 |
# File 'lib/vagrant_blocker/config.rb', line 14 def finalize! @strict_config = true if @strict_config == UNSET_VALUE @blocks = [] if @blocks == UNSET_VALUE @blocks = [@blocks].flatten.uniq.map(&:to_sym) end |
#validate(machine) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/vagrant_blocker/config.rb', line 20 def validate(machine) errors = [] @blocks.each do |blocker| next if machine.env.machine_names.include?(blocker) errors << I18n.t('vagrant_blocker.warnings.blocker_not_found', blocker: blocker.to_s, name: machine.name.to_s) end report(errors, machine.env.ui) end |