Class: VagrantPlugins::Utm::Action::Suspend

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant_utm/action/suspend.rb

Overview

This action is responsible for suspending the VM.

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ Suspend

Returns a new instance of Suspend.



8
9
10
# File 'lib/vagrant_utm/action/suspend.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_utm/action/suspend.rb', line 12

def call(env)
  if env[:machine].state.id == :started
    env[:ui].info I18n.t("vagrant.actions.vm.suspend.suspending")
    env[:machine].provider.driver.suspend
  end

  @app.call(env)
end