Class: VagrantPlugins::HostShell::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::HostShell::Config
- Defined in:
- lib/vagrant-host-shell/config.rb
Instance Attribute Summary collapse
-
#abort_on_nonzero ⇒ Object
Returns the value of attribute abort_on_nonzero.
-
#cwd ⇒ Object
Returns the value of attribute cwd.
-
#inline ⇒ Object
Returns the value of attribute inline.
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-host-shell/config.rb', line 7 def initialize @inline = UNSET_VALUE @cwd = UNSET_VALUE @abort_on_nonzero = UNSET_VALUE end |
Instance Attribute Details
#abort_on_nonzero ⇒ Object
Returns the value of attribute abort_on_nonzero.
5 6 7 |
# File 'lib/vagrant-host-shell/config.rb', line 5 def abort_on_nonzero @abort_on_nonzero end |
#cwd ⇒ Object
Returns the value of attribute cwd.
4 5 6 |
# File 'lib/vagrant-host-shell/config.rb', line 4 def cwd @cwd end |
#inline ⇒ Object
Returns the value of attribute inline.
3 4 5 |
# File 'lib/vagrant-host-shell/config.rb', line 3 def inline @inline end |
Instance Method Details
#finalize! ⇒ Object
13 14 15 16 17 |
# File 'lib/vagrant-host-shell/config.rb', line 13 def finalize! @inline = nil if @inline == UNSET_VALUE @cwd = nil if @cwd == UNSET_VALUE @abort_on_nonzero = false if @abort_on_nonzero == UNSET_VALUE end |
#validate(machine) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vagrant-host-shell/config.rb', line 19 def validate(machine) errors = _detected_errors unless inline errors << ':host_shell provisioner requires inline to be set' end unless abort_on_nonzero.is_a?(TrueClass) || abort_on_nonzero.is_a?(FalseClass) errors << ':host_shell provisioner requires abort_on_nonzero to be a boolean' end unless cwd.is_a?(String) || cwd.nil? errors << ':host_shell provisioner requires cwd to be a string or nil' end { 'host shell provisioner' => errors } end |