Sha256: b0e5f14f6ecc47b7934dc72d558ec625ff7baf70be3e1ae8e69608ae4263649a

Contents?: true

Size: 243 Bytes

Versions: 2

Compression:

Stored size: 243 Bytes

Contents

module RExec
	# Updates the global ENV for the duration of block. Not multi-thread safe.
	def self.env (new_env = nil, &block)
	  old_env = ENV.to_hash

	  ENV.update(new_env) if new_env

	  yield

	  ENV.clear
	  ENV.update(old_env)
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rexec-1.2.1 lib/rexec/environment.rb
rexec-1.1.12 lib/rexec/environment.rb