Class: ENV

Inherits:
Object show all
Defined in:
lib/g-gem/core_extensions.rb

Class Method Summary collapse

Class Method Details

.with(hash) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/g-gem/core_extensions.rb', line 2

def with(hash)
    oldenv = {}
    hash.each_pair do |key, val|
      oldenv[key.to_sym], ENV[key.to_s] = ENV[key.to_s], val
    end
    yield
    oldenv.each_pair do |key, val|
      ENV[key.to_s] = val
    end
end