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.
Fetch the given environment variable from the backing data.
Parameter
key (String)
Returns
(String, nil)
#backing_data
defbacking_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.
Returns
(Hash{String=>String})
#backing_data=
defbacking_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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Platform environment queries - Class Google::Cloud::Env::Variables (v2.3.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.3.1 (latest)](/ruby/docs/reference/google-cloud-env/latest/Google-Cloud-Env-Variables)\n- [2.3.0](/ruby/docs/reference/google-cloud-env/2.3.0/Google-Cloud-Env-Variables)\n- [2.2.2](/ruby/docs/reference/google-cloud-env/2.2.2/Google-Cloud-Env-Variables) \nReference documentation and code samples for the Google Cloud Platform environment queries class Google::Cloud::Env::Variables.\n\nAccess to system environment variables.\n\n\n\u003cbr /\u003e\n\nThis is a hashlike object that controls access to environment variable\ndata. It supports temporarily changing the data source (i.e. swapping\n::ENV out for a different set of data) for mocking. \n\nInherits\n--------\n\n- Object\n\nMethods\n-------\n\n### #\\[\\]\n\n def [](key) -\u003e String, nil\n\n**Aliases**\n\n- [#get](./Google-Cloud-Env-Variables#Google__Cloud__Env__Variables_get_instance_) \nFetch the given environment variable from the backing data. \n**Parameter**\n\n- **key** (String) \n**Returns**\n\n- (String, nil)\n\n### #backing_data\n\n def backing_data() -\u003e Hash{String=\u003eString}\n\nThe backing data is a hash or hash-like object that represents the\nenvironment variable data. This can either be the actual environment\nvariables object (i.e. ENV) or a substitute hash used for mocking. \n**Returns**\n\n- (Hash{String=\\\u003eString})\n\n### #backing_data=\n\n def backing_data=(value) -\u003e Hash{String=\u003eString}\n\nThe backing data is a hash or hash-like object that represents the\nenvironment variable data. This can either be the actual environment\nvariables object (i.e. ENV) or a substitute hash used for mocking. \n**Parameter**\n\n- **value** (Hash{String=\\\u003eString}) \n**Returns**\n\n- (Hash{String=\\\u003eString})\n\n### #get\n\n def get(key) -\u003e String, nil\n\n**Alias Of** : [#\\[\\]](./Google-Cloud-Env-Variables#Google__Cloud__Env__Variables_[]_instance_) \nFetch the given environment variable from the backing data. \n**Parameter**\n\n- **key** (String) \n**Returns**\n\n- (String, nil)\n\n### #initialize\n\n def initialize() -\u003e Variables\n\nCreate an enviroment variables access object. This is initially\nbacked by the actual environment variables (i.e. ENV). \n**Returns**\n\n- ([Variables](./Google-Cloud-Env-Variables)) --- a new instance of Variables\n\n### #with_backing_data\n\n def with_backing_data(temp_backing_data)\n\nRun the given block with the backing data replaced with the given\nhash. The original backing data is restored afterward. This is used\nfor debugging/testing/mocking. \n**Parameter**\n\n- **temp_backing_data** (Hash{String=\\\u003eString})"]]