Method: Tap::Utils.with_env
- Defined in:
- lib/tap/utils.rb
.with_env(env = {}, replace = false) ⇒ Object
Sets the specified ENV variables for the duration of the block. If replace is true, current ENV variables are replaced; otherwise the new env variables are simply added to the existing set.
Returns the block return.
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/tap/utils.rb', line 62 def with_env(env={}, replace=false) current_env = nil begin current_env = set_env(env, replace) yield ensure if current_env set_env(current_env, true) end end end |