Reference documentation and code samples for the Google Cloud Platform environment queries class Google::Cloud::Env::ComputeSMBIOS.
Access to the SMBIOS information needed to determine if this Ruby
process is running on a Google compute platform.
This information lives at a file system path on Linux, but in the
Registry on Windows.
You can provide an override to "mock out" the behavior of this object.
Inherits
Object
Methods
#google_compute?
defgoogle_compute?()->true,false
Determine whether the SMBIOS state suggests that we are running on a
Google compute platform.
This method may read the file system (on Linux) or registry (on
Windows) the first time it is called, but it will cache the result
for subsequent calls.
The current override value for the product name, either a string
value, or nil to disable mocking.
Returns
(nil, String)
#override_product_name=
defoverride_product_name=(value)->nil,String
The current override value for the product name, either a string
value, or nil to disable mocking.
Parameter
value(nil, String)
Returns
(nil, String)
#product_name
defproduct_name()->String
Read the product name. On a Google compute platform, this should
include the word "Google".
This method may read the file system (on Linux) or registry (on
Windows) the first time it is called, but it will cache the result
for subsequent calls.
Returns
(String) — Product name, or the empty string if not found.
#product_name_source
defproduct_name_source()->Symbol
The source of the product name data. Will be one of the following:
:linux- The data comes from the Linux SMBIOS under /sys
:windows- The data comes from the Windows Registry
:error- The data could not be obtained
:override- The data comes from an override
This method may read the file system (on Linux) or registry (on
Windows) the first time it is called, but it will cache the result
for subsequent calls.
Returns
(Symbol) — The source
#with_override_product_name
defwith_override_product_name(override_name)
Run the given block with the product name mock modified. This is
generally 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::ComputeSMBIOS (v2.3.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.3.1 (latest)](/ruby/docs/reference/google-cloud-env/latest/Google-Cloud-Env-ComputeSMBIOS)\n- [2.3.0](/ruby/docs/reference/google-cloud-env/2.3.0/Google-Cloud-Env-ComputeSMBIOS)\n- [2.2.2](/ruby/docs/reference/google-cloud-env/2.2.2/Google-Cloud-Env-ComputeSMBIOS) \nReference documentation and code samples for the Google Cloud Platform environment queries class Google::Cloud::Env::ComputeSMBIOS.\n\nAccess to the SMBIOS information needed to determine if this Ruby\nprocess is running on a Google compute platform.\n\n\nThis information lives at a file system path on Linux, but in the\nRegistry on Windows.\n\n\u003cbr /\u003e\n\nYou can provide an override to \"mock out\" the behavior of this object. \n\nInherits\n--------\n\n- Object\n\nMethods\n-------\n\n### #google_compute?\n\n def google_compute?() -\u003e true, false\n\nDetermine whether the SMBIOS state suggests that we are running on a\nGoogle compute platform.\n\n\n\u003cbr /\u003e\n\nThis method may read the file system (on Linux) or registry (on\nWindows) the first time it is called, but it will cache the result\nfor subsequent calls. \n**Returns**\n\n- (true, false)\n\n### #initialize\n\n def initialize() -\u003e ComputeSMBIOS\n\nCreate an SMBIOS access object \n**Returns**\n\n- ([ComputeSMBIOS](./Google-Cloud-Env-ComputeSMBIOS)) --- a new instance of ComputeSMBIOS\n\n### #override_product_name\n\n def override_product_name() -\u003e nil, String\n\nThe current override value for the product name, either a string\nvalue, or nil to disable mocking. \n**Returns**\n\n- (nil, String)\n\n### #override_product_name=\n\n def override_product_name=(value) -\u003e nil, String\n\nThe current override value for the product name, either a string\nvalue, or nil to disable mocking. \n**Parameter**\n\n- **value** (nil, String) \n**Returns**\n\n- (nil, String)\n\n### #product_name\n\n def product_name() -\u003e String\n\nRead the product name. On a Google compute platform, this should\ninclude the word \"Google\".\n\n\n\u003cbr /\u003e\n\nThis method may read the file system (on Linux) or registry (on\nWindows) the first time it is called, but it will cache the result\nfor subsequent calls. \n**Returns**\n\n- (String) --- Product name, or the empty string if not found.\n\n### #product_name_source\n\n def product_name_source() -\u003e Symbol\n\nThe source of the product name data. Will be one of the following:\n\n\n- `:linux` - The data comes from the Linux SMBIOS under /sys\n- `:windows` - The data comes from the Windows Registry\n- `:error` - The data could not be obtained\n- `:override` - The data comes from an override\n\n\u003cbr /\u003e\n\nThis method may read the file system (on Linux) or registry (on\nWindows) the first time it is called, but it will cache the result\nfor subsequent calls. \n**Returns**\n\n- (Symbol) --- The source\n\n### #with_override_product_name\n\n def with_override_product_name(override_name)\n\nRun the given block with the product name mock modified. This is\ngenerally used for debugging/testing/mocking. \n**Parameter**\n\n- **override_name** (nil, String)"]]