class Bundler::EnvironmentPreserver
def backup
-
(Hash)
-
def backup env = @original.clone @keys.each do |key| value = env[key] if !value.nil? && !value.empty? env[@prefix + key] ||= value elsif value.nil? env[@prefix + key] ||= INTENTIONALLY_NIL end end env end
def initialize(env, keys)
-
keys
(Array
) -- -
env
(ENV
) --
def initialize(env, keys) @original = env.to_hash @keys = keys @prefix = BUNDLER_PREFIX end
def restore
-
(Hash)
-
def restore env = @original.clone @keys.each do |key| value_original = env[@prefix + key] next if value_original.nil? || value_original.empty? if value_original == INTENTIONALLY_NIL env.delete(key) else env[key] = value_original end env.delete(@prefix + key) end env end