Sha256: 6530d5ecec13315b00f04447c26c30dbcf37bddba68c03f20ae60f1d45b1f1ed
Contents?: true
Size: 843 Bytes
Versions: 64
Compression:
Stored size: 843 Bytes
Contents
# encoding: utf-8 module FeduxOrgStdlib 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 alias_method :with_environment, :isolated_environment end end
Version data entries
64 entries across 64 versions & 1 rubygems