Class: Aruba::Platforms::LocalEnvironment

Inherits:
Object
  • Object
show all
Defined in:
lib/aruba/platforms/local_environment.rb

Overview

Local environemnt

Wraps logic to make enviroment local and restorable

Instance Method Summary collapse

Instance Method Details

#call(env) { ... } ⇒ Object

Run in environment

Parameters:

  • env (Hash)

    The environment

Yields:

  • The block of code which should with local ENV



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/aruba/platforms/local_environment.rb', line 16

def call(env)
  old_env = Aruba.platform.environment_variables.hash_from_env

  ENV.clear
  ENV.update env

  yield if block_given?
ensure
  ENV.clear
  ENV.update old_env
end