Module: FeduxOrgStdlib::Environment
- Included in:
- Command::RunCommand
- Defined in:
- lib/fedux_org_stdlib/environment.rb
Instance Method Summary collapse
-
#isolated_environment(new_environment_variables, options = {}) { ... } ⇒ Object
(also: #with_environment)
Set environment variable for code block.
Instance Method Details
#isolated_environment(new_environment_variables, options = {}) { ... } ⇒ Object Also known as: with_environment
Set environment variable for code block
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fedux_org_stdlib/environment.rb', line 18 def isolated_environment(new_environment_variables, ={}, &block) old_environment = ENV.to_hash ENV.clear if [:clear] == true ENV.update new_environment_variables block.call ensure ENV.clear ENV.update old_environment end |