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)


8
9
10
11
12
13
14
15
# File 'lib/vagrant/action/builtin/delayed.rb', line 8

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


17
18
19
20
21
22
# File 'lib/vagrant/action/builtin/delayed.rb', line 17

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