Class: Aruba::Platforms::LocalEnvironment
- Inherits:
-
Object
- Object
- Aruba::Platforms::LocalEnvironment
- Defined in:
- lib/aruba/platforms/local_environment.rb
Overview
Local environemnt
Wraps logic to make enviroment local and restorable
Instance Attribute Summary collapse
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
Instance Method Summary collapse
-
#call(env) { ... } ⇒ Object
Run in environment.
-
#initialize(platform) ⇒ LocalEnvironment
constructor
A new instance of LocalEnvironment.
Constructor Details
#initialize(platform) ⇒ LocalEnvironment
Returns a new instance of LocalEnvironment.
11 12 13 |
# File 'lib/aruba/platforms/local_environment.rb', line 11 def initialize(platform) @platform = platform end |
Instance Attribute Details
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
15 16 17 |
# File 'lib/aruba/platforms/local_environment.rb', line 15 def platform @platform end |
Instance Method Details
#call(env) { ... } ⇒ Object
Run in environment
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/aruba/platforms/local_environment.rb', line 24 def call(env) old_env = platform.environment_variables.hash_from_env ENV.clear ENV.update env yield if block_given? ensure ENV.clear ENV.update old_env end |