Class: Aruba::Platforms::WindowsEnvironmentVariables
Overview
Windows is case-insensitive when it accesses its environment variables.
To work around this we turn all of the environment variable keys to upper-case so that aruba is ensured that accessing environment variables with upper-case keys will always work. See the following examples.
values no matter the case of the key:
ENV["Path"] ENV["PATH"]
Constant Summary
UnixEnvironmentVariables::UNDEFINED
Class Method Summary
collapse
Instance Method Summary
collapse
#clear, #method_missing, #nest, #respond_to_missing?, #to_h
Constructor Details
Returns a new instance of WindowsEnvironmentVariables.
40
41
42
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 40
def initialize(env = ENV)
super(upcase_env env)
end
|
Class Method Details
.hash_from_env ⇒ Object
76
77
78
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 76
def self.hash_from_env
upcase_env(ENV)
end
|
.upcase_env(env) ⇒ Object
80
81
82
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 80
def self.upcase_env(env)
env.to_h.transform_keys { |k| k.to_s.upcase }
end
|
Instance Method Details
#[](name) ⇒ Object
56
57
58
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 56
def [](name)
super(name.upcase)
end
|
#[]=(name, value) ⇒ Object
60
61
62
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 60
def []=(name, value)
super(name.upcase, value)
end
|
#append(name, value) ⇒ Object
64
65
66
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 64
def append(name, value)
super(name.upcase, value)
end
|
#delete(name) ⇒ Object
72
73
74
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 72
def delete(name)
super(name.upcase)
end
|
#fetch(name, default = UnixEnvironmentVariables::UNDEFINED) ⇒ Object
48
49
50
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 48
def fetch(name, default = UnixEnvironmentVariables::UNDEFINED)
super(name.upcase, default)
end
|
#key?(name) ⇒ Boolean
52
53
54
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 52
def key?(name)
super(name.upcase)
end
|
#prepend(name, value) ⇒ Object
68
69
70
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 68
def prepend(name, value)
super(name.upcase, value)
end
|
#update(other_env, &block) ⇒ Object
44
45
46
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 44
def update(other_env, &block)
super(upcase_env(other_env), &block)
end
|