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.
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.
37
38
39
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 37
def initialize(env = ENV)
super(upcase_env env)
end
|
Class Method Details
.hash_from_env ⇒ Object
73
74
75
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 73
def self.hash_from_env
upcase_env(ENV)
end
|
.upcase_env(env) ⇒ Object
77
78
79
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 77
def self.upcase_env(env)
env.each_with_object({}) { |(k, v), a| a[k.to_s.upcase] = v }
end
|
Instance Method Details
#[](name) ⇒ Object
53
54
55
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 53
def [](name)
super(name.upcase)
end
|
#[]=(name, value) ⇒ Object
57
58
59
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 57
def []=(name, value)
super(name.upcase, value)
end
|
#append(name, value) ⇒ Object
61
62
63
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 61
def append(name, value)
super(name.upcase, value)
end
|
#delete(name) ⇒ Object
69
70
71
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 69
def delete(name)
super(name.upcase)
end
|
#fetch(name, default = UnixEnvironmentVariables::UNDEFINED) ⇒ Object
45
46
47
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 45
def fetch(name, default = UnixEnvironmentVariables::UNDEFINED)
super(name.upcase, default)
end
|
#key?(name) ⇒ Boolean
49
50
51
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 49
def key?(name)
super(name.upcase)
end
|
#prepend(name, value) ⇒ Object
65
66
67
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 65
def prepend(name, value)
super(name.upcase, value)
end
|
#update(other_env, &block) ⇒ Object
41
42
43
|
# File 'lib/aruba/platforms/windows_environment_variables.rb', line 41
def update(other_env, &block)
super(upcase_env(other_env), &block)
end
|