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.
38
39
40
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 38
def initialize(env = ENV)
super(upcase_env env)
end
|
Class Method Details
.hash_from_env ⇒ Object
74
75
76
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 74
def self.hash_from_env
upcase_env(ENV)
end
|
.upcase_env(env) ⇒ Object
78
79
80
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 78
def self.upcase_env(env)
env.to_h.transform_keys { |k| k.to_s.upcase }
end
|
Instance Method Details
#[](name) ⇒ Object
54
55
56
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 54
def [](name)
super(name.upcase)
end
|
#[]=(name, value) ⇒ Object
58
59
60
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 58
def []=(name, value)
super(name.upcase, value)
end
|
#append(name, value) ⇒ Object
62
63
64
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 62
def append(name, value)
super(name.upcase, value)
end
|
#delete(name) ⇒ Object
70
71
72
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 70
def delete(name)
super(name.upcase)
end
|
#fetch(name, default = UnixEnvironmentVariables::UNDEFINED) ⇒ Object
46
47
48
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 46
def fetch(name, default = UnixEnvironmentVariables::UNDEFINED)
super(name.upcase, default)
end
|
#key?(name) ⇒ Boolean
50
51
52
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 50
def key?(name)
super(name.upcase)
end
|
#prepend(name, value) ⇒ Object
66
67
68
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 66
def prepend(name, value)
super(name.upcase, value)
end
|
#update(other_env, &block) ⇒ Object
42
43
44
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 42
def update(other_env, &block)
super(upcase_env(other_env), &block)
end
|