Class: VagrantPlugins::Utm::Action::IsRunning

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

Overview

This middleware checks if the machine is running (UTM started) and sets the result.

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ IsRunning

Returns a new instance of IsRunning.



11
12
13
# File 'lib/vagrant_utm/action/is_running.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_running.rb', line 15

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

  # 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