Module: LinuxStat::BIOS

Defined in:
lib/linux_stat/bios.rb

Overview

Shows various BIOS related information of the current system.

Class Method Summary collapse

Class Method Details

.date ⇒ Object

Returns the date of the BIOS.

If the information is not available it will return a frozen empty string.

The output is also cached (memoized) ; as changing the value in runtime is unexpected.



58
59
60
61
62
63
64
# File 'lib/linux_stat/bios.rb', line 58

def date
	@@date ||= if File.readable?('/sys/devices/virtual/dmi/id/bios_date')
		IO.read('/sys/devices/virtual/dmi/id/bios_date').tap(&:strip!)
	else
		''.freeze
	end
end

.model ⇒ Object

Returns the model of the BIOS.

If the information is not available it will return a frozen empty string.

The output is also cached (memoized) ; as changing the value in runtime is unexpected.



12
13
14
15
16
17
18
19
20
21
# File 'lib/linux_stat/bios.rb', line 12

def model
	# cached (memoized) ; as changing the value in runtime is unexpected
	@@model ||= if File.readable?('/sys/devices/virtual/dmi/id/product_name')
		IO.read('/sys/devices/virtual/dmi/id/product_name').tap(&:strip!)
	elsif File.readable?('/sys/firmware/devicetree/base/model')
		IO.read('/sys/firmware/devicetree/base/model').tap(&:strip!)
	else
		''.freeze
	end
end

.vendor ⇒ Object

Returns the vendor of the BIOS.

If the information is not available it will return a frozen empty string.

The output is also cached (memoized) ; as changing the value in runtime is unexpected.



29
30
31
32
33
34
35
36
# File 'lib/linux_stat/bios.rb', line 29

def vendor
	# cached (memoized) ; as changing the value in runtime is unexpected
	@@vendor ||= if File.readable?('/sys/devices/virtual/dmi/id/bios_vendor')
		IO.read('/sys/devices/virtual/dmi/id/bios_vendor').tap(&:strip!)
	else
		''.freeze
	end
end

.version ⇒ Object

Returns the version of the BIOS.

If the information is not available it will return a frozen empty string.

The output is also cached (memoized) ; as changing the value in runtime is unexpected.



44
45
46
47
48
49
50
# File 'lib/linux_stat/bios.rb', line 44

def version
	@@version ||= if File.readable?('/sys/devices/virtual/dmi/id/bios_version')
		IO.read('/sys/devices/virtual/dmi/id/bios_version').tap(&:strip!)
	else
		''.freeze
	end
end