Method: WithEnv#with_env

Defined in:
lib/with_env.rb

#with_env(env, &blk) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/with_env.rb', line 6

def with_env(env, &blk)
  before = ENV.to_h.dup
  env.each { |k, v| ENV[k] = v }
  yield
ensure
  ENV.replace(before)
end