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?
def google_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.
- (true, false)
#initialize
def initialize() -> ComputeSMBIOS
Create an SMBIOS access object
- (ComputeSMBIOS) — a new instance of ComputeSMBIOS
#override_product_name
def override_product_name() -> nil, String
The current override value for the product name, either a string value, or nil to disable mocking.
- (nil, String)
#override_product_name=
def override_product_name=(value) -> nil, String
The current override value for the product name, either a string value, or nil to disable mocking.
- value (nil, String)
- (nil, String)
#product_name
def product_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.
- (String) — Product name, or the empty string if not found.
#product_name_source
def product_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.
- (Symbol) — The source
#with_override_product_name
def with_override_product_name(override_name)
Run the given block with the product name mock modified. This is generally used for debugging/testing/mocking.
- override_name (nil, String)