Sha256: 2a76fb97e61c7dd2d3401db889d4f27029f4c0259b169296c098142dd168d810
Contents?: true
Size: 545 Bytes
Versions: 14
Compression:
Stored size: 545 Bytes
Contents
# frozen_string_literal: true module EacRubyUtils class << self def on_clean_ruby_environment on_clean_envvars('BUNDLE', 'RUBY') { yield } end private def on_clean_envvars(*start_with_vars) old_values = envvars_starting_with(start_with_vars) old_values.keys.each { |k| ENV.delete(k) } yield ensure old_values&.each { |k, v| ENV[k] = v } end def envvars_starting_with(start_with_vars) ENV.select { |k, _v| start_with_vars.any? { |var| k.start_with?(var) } } end end end
Version data entries
14 entries across 14 versions & 2 rubygems