Class: HashiCorp::VagrantVMwareDesktop::Action::Suspended

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/vagrant-vmware-desktop/action/suspended.rb

Overview

This can be used with “Call” built-in to check if the machine is suspended.

Instance Method Summary collapse

Methods included from Common

#to_s

Constructor Details

#initialize(app, env) ⇒ Suspended

Returns a new instance of Suspended.



11
12
13
14
# File 'lib/vagrant-vmware-desktop/action/suspended.rb', line 11

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("hashicorp::provider::vmware::suspended")
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
# File 'lib/vagrant-vmware-desktop/action/suspended.rb', line 16

def call(env)
  env[:result] = env[:machine].state.id == :suspended
  @logger.debug("result: #{env[:result].inspect}")
  @app.call(env)
end