Class: VagrantPlugins::SoftLayer::Action::Is

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-softlayer/action/is.rb

Overview

This can be used with “Call” built-in to check if the machine is in the given status.

Instance Method Summary collapse

Constructor Details

#initialize(app, env, status) ⇒ Is

Returns a new instance of Is.



7
8
9
10
# File 'lib/vagrant-softlayer/action/is.rb', line 7

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

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
# File 'lib/vagrant-softlayer/action/is.rb', line 12

def call(env)
  env[:result] = env[:machine].state.id == @status

  # Carry on, just in case
  @app.call(env)
end