Class: VagrantPlugins::Filoo::Action::IsStopped

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant_filoo/action/is_stopped.rb

Overview

This can be used with “Call” built-in to check if the machine is stopped and branch in the middleware.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ IsStopped

Returns a new instance of IsStopped.



7
8
9
# File 'lib/vagrant_filoo/action/is_stopped.rb', line 7

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

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
# File 'lib/vagrant_filoo/action/is_stopped.rb', line 11

def call(env)
  env[:result] = env[:machine].state.id == :stopped
  @app.call(env)
end