Class: VagrantPlugins::Utm::Action::IsPaused

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

Overview

This middleware checks if the machine is paused and sets the result.

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ IsPaused

Returns a new instance of IsPaused.



11
12
13
# File 'lib/vagrant_utm/action/is_paused.rb', line 11

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

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/vagrant_utm/action/is_paused.rb', line 15

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

  # 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