Class: VagrantPlugins::VCenter::Action::IsPaused

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vcenter/action/is_paused.rb

Overview

This class sets the state to suspended if the VM is suspended.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ IsPaused

Returns a new instance of IsPaused.



8
9
10
# File 'lib/vagrant-vcenter/action/is_paused.rb', line 8

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

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/vagrant-vcenter/action/is_paused.rb', line 12

def call(env)
  # Set the result to be true if the machine is suspended.
  env[:result] = env[:machine].state.id == :suspended

  # Call the next if we have one (but we shouldn't, since this
  # middleware is built to run with the Call-type middlewares)
  @app.call(env)
end