Class: Vagrant::Action::VM::Suspend

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

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Suspend

Returns a new instance of Suspend.



5
6
7
# File 'lib/vagrant/action/vm/suspend.rb', line 5

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

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/vagrant/action/vm/suspend.rb', line 9

def call(env)
  if env["vm"].vm.running?
    env.ui.info I18n.t("vagrant.actions.vm.suspend.suspending")
    env["vm"].vm.save_state
  end

  @app.call(env)
end