Class: EacRubyUtils::Ruby::OnCleanEnvironment

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_ruby_utils/ruby/on_clean_environment.rb

Constant Summary collapse

ENVVARS_PREFIXES_TO_CLEAN =
%w[BUNDLE RUBY].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ OnCleanEnvironment

Returns a new instance of OnCleanEnvironment.



19
20
21
22
# File 'lib/eac_ruby_utils/ruby/on_clean_environment.rb', line 19

def initialize(&block)
  @block = block
  @original_env = ::ENV.to_h
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



17
18
19
# File 'lib/eac_ruby_utils/ruby/on_clean_environment.rb', line 17

def block
  @block
end

#original_envObject (readonly)

Returns the value of attribute original_env.



17
18
19
# File 'lib/eac_ruby_utils/ruby/on_clean_environment.rb', line 17

def original_env
  @original_env
end

Instance Method Details

#envvars_prefixes_to_cleanArray<String>

Returns:



25
26
27
# File 'lib/eac_ruby_utils/ruby/on_clean_environment.rb', line 25

def envvars_prefixes_to_clean
  ENVVARS_PREFIXES_TO_CLEAN
end

#performObject



29
30
31
32
33
# File 'lib/eac_ruby_utils/ruby/on_clean_environment.rb', line 29

def perform
  bundler_with_unbundled_env do
    on_clean_envvars
  end
end