Class: VagrantPlugins::Skytap::Action::IsStopped

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-skytap/action/is_stopped.rb

Overview

This can be used with “Call” built-in to check if the machine is stopped and branch in the middleware.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ IsStopped

Returns a new instance of IsStopped.



7
8
9
10
# File 'lib/vagrant-skytap/action/is_stopped.rb', line 7

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("vagrant_skytap::action::is_stopped")
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
# File 'lib/vagrant-skytap/action/is_stopped.rb', line 12

def call(env)
  env[:result] = env[:machine].state.id == :stopped
  @app.call(env)
end