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.



12
13
14
15
# File 'lib/vagrant/action/builtin/env_set.rb', line 12

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

Instance Method Details

#call(env) ⇒ Object



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

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

  # Carry on
  @app.call(env)
end