Class: Vagrant::Action::Builtin::Delayed

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/action/builtin/delayed.rb

Overview

This class is used to delay execution until the end of a configured stack

Instance Method Summary collapse

Constructor Details

#initialize(app, env, callable) ⇒ Delayed

Returns a new instance of Delayed.

Parameters:

  • callable (Object)

    The object to call (must respond to #call)



11
12
13
14
15
16
17
18
# File 'lib/vagrant/action/builtin/delayed.rb', line 11

def initialize(app, env, callable)
  if !callable.respond_to?(:call)
    raise TypeError, "Callable argument is expected to respond to `#call`"
  end
  @app         = app
  @env         = env
  @callable    = callable
end

Instance Method Details

#call(env) ⇒ Object



20
21
22
23
24
25
# File 'lib/vagrant/action/builtin/delayed.rb', line 20

def call(env)
  # Allow the rest of the call stack to execute
  @app.call(env)
  # Now call our delayed stack
  @callable.call(env)
end