Reference documentation and code samples for the Google Cloud Platform environment queries class Google::Cloud::Env::Variables.
Access to system environment variables.
This is a hashlike object that controls access to environment variable data. It supports temporarily changing the data source (i.e. swapping ::ENV out for a different set of data) for mocking.
Inherits
- Object
Methods
#[]
def
[]
(
key
)
-
>
String
,
nil
Fetch the given environment variable from the backing data.
- key(String)
- (String, nil)
#backing_data
def
backing_data
()
-
>
Hash
{
String
=
> String
}
The backing data is a hash or hash-like object that represents the environment variable data. This can either be the actual environment variables object (i.e. ENV) or a substitute hash used for mocking.
- (Hash{String=>String})
#backing_data=
def
backing_data=
(
value
)
-
>
Hash
{
String
=
> String
}
The backing data is a hash or hash-like object that represents the environment variable data. This can either be the actual environment variables object (i.e. ENV) or a substitute hash used for mocking.
- value(Hash{String=>String})
- (Hash{String=>String})
#get
def
get
(
key
)
-
>
String
,
nil
Fetch the given environment variable from the backing data.
- key(String)
- (String, nil)
#initialize
def
initialize
()
-
>
Variables
Create an enviroment variables access object. This is initially backed by the actual environment variables (i.e. ENV).
- ( Variables ) — a new instance of Variables
#with_backing_data
def
with_backing_data
(
temp_backing_data
)
Run the given block with the backing data replaced with the given hash. The original backing data is restored afterward. This is used for debugging/testing/mocking.
- temp_backing_data(Hash{String=>String})