Sha256: 3fde5fcc37b202d754f55122106b0d6d31b8d0d0327674d790007ca433b1ece8
Contents?: true
Size: 830 Bytes
Versions: 12
Compression:
Stored size: 830 Bytes
Contents
module FeduxOrg module Stdlib module Environment # Set environment variable for code block # # @param [Hash] new_environment_variables # the variables which should be set for that environment # # @param [Hash] options # options for environment manipulation # # @option options [True,False] :clear # Should the environment clear before merge? # # @yield # the block which should be run which the change environment def isolated_environment(new_environment_variables, options={}, &block) old_environment = ENV.to_hash ENV.clear if options[:clear] == true ENV.update new_environment_variables block.call ensure ENV.clear ENV.update old_environment end end end end
Version data entries
12 entries across 12 versions & 1 rubygems