Class: VagrantPlugins::Proxy::Action::IsRunningOrActive
- Inherits:
-
Object
- Object
- VagrantPlugins::Proxy::Action::IsRunningOrActive
- Defined in:
- lib/vagrant-proxy/action/is_running_or_active.rb
Overview
This action checks if the machine is running (virtualbox) or active (aws, rackspace).
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ IsRunningOrActive
constructor
A new instance of IsRunningOrActive.
Constructor Details
#initialize(app, env) ⇒ IsRunningOrActive
Returns a new instance of IsRunningOrActive.
26 27 28 |
# File 'lib/vagrant-proxy/action/is_running_or_active.rb', line 26 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/vagrant-proxy/action/is_running_or_active.rb', line 30 def call(env) # Set the result to be true if the machine is :running or :active. if (env[:machine].state.id == :running) || (env[:machine].state.id == :active) env[:result] = true else env[:result] = false end # 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 |