Sha256: 5f9e448f7d3b8a41ca93ed0810630e54c54e147d45c32a0ab373066450681069
Contents?: true
Size: 573 Bytes
Versions: 3
Compression:
Stored size: 573 Bytes
Contents
module BobTheHelper module Environment # Set environment variable for code block # # @param [Hash] variables # the variables which should be set for that environment # # @yield # the block which should be run which the change environment def isolated_environment(variables, &block) #backup old_env = ENV.to_hash #change env ENV.update variables block_result = block.call #cleanup ENV.clear #install backuped information ENV.update old_env block_result end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pointrb-0.1.2 | lib/bob_the_helper/environment.rb |
pointrb-0.1.1 | lib/bob_the_helper/environment.rb |
pointrb-0.1.0 | lib/bob_the_helper/environment.rb |