Class: VagrantPlugins::Google::Action::IsTerminated

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-google/action/is_terminated.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) ⇒ IsTerminated

Returns a new instance of IsTerminated.



20
21
22
# File 'lib/vagrant-google/action/is_terminated.rb', line 20

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



24
25
26
27
# File 'lib/vagrant-google/action/is_terminated.rb', line 24

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