sakama/vagrant-niftycloud

View on GitHub
lib/vagrant-niftycloud/action/is_created.rb

Summary

Maintainability
A
0 mins
Test Coverage
module VagrantPlugins
  module NiftyCloud
    module Action
      # This can be used with "Call" built-in to check if the machine
      # is created and branch in the middleware.
      class IsCreated
        def initialize(app, env)
          @app = app
        end

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