Method: WithEnv#without_env

Defined in:
lib/with_env.rb

#without_env(*keys, &blk) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/with_env.rb', line 14

def without_env(*keys, &blk)
  before = ENV.to_h.dup
  keys.flatten.each { |k| ENV.delete(k) }
  yield
ensure
  ENV.replace(before)
end