Class: Vagrant::Action::Builtin::EnvSet

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

Overview

This middleware class allows you to modify the environment hash in the middle of a middleware sequence. The new environmental data will take affect at this stage in the middleware and will persist through.

Instance Method Summary collapse

Constructor Details

#initialize(app, env, new_env = nil) ⇒ EnvSet

Returns a new instance of EnvSet.



9
10
11
12
# File 'lib/vagrant/action/builtin/env_set.rb', line 9

def initialize(app, env, new_env=nil)
  @app     = app
  @new_env = new_env || {}
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/vagrant/action/builtin/env_set.rb', line 14

def call(env)
  # Merge in the new data
  env.merge!(@new_env)

  # Carry on
  @app.call(env)
end