Class: Atatus::Metadata::SystemInfo::HWInfo Private
- Inherits:
-
Object
- Object
- Atatus::Metadata::SystemInfo::HWInfo
- Defined in:
- lib/atatus/metadata/system_info/hw_info.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #cpuinfo_cores ⇒ Object private
- #cpuinfo_mhz ⇒ Object private
- #cpuinfo_model ⇒ Object private
- #host_bootid ⇒ Object private
- #meminfo_total ⇒ Object private
Class Method Summary collapse
- .read! ⇒ Object private
Instance Method Summary collapse
-
#cpuinfo ⇒ Object
private
rubocop:disable Metrics/MethodLength.
-
#hostid ⇒ Object
private
rubocop:disable Metrics/MethodLength.
-
#initialize ⇒ HWInfo
constructor
private
A new instance of HWInfo.
-
#meminfo ⇒ Object
private
rubocop:enable Metrics/MethodLength.
- #read! ⇒ Object private
Constructor Details
#initialize ⇒ HWInfo
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of HWInfo.
13 14 15 |
# File 'lib/atatus/metadata/system_info/hw_info.rb', line 13 def initialize @os = RbConfig::CONFIG['target_os'] end |
Instance Attribute Details
#cpuinfo_cores ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/atatus/metadata/system_info/hw_info.rb', line 10 def cpuinfo_cores @cpuinfo_cores end |
#cpuinfo_mhz ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/atatus/metadata/system_info/hw_info.rb', line 10 def cpuinfo_mhz @cpuinfo_mhz end |
#cpuinfo_model ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/atatus/metadata/system_info/hw_info.rb', line 10 def cpuinfo_model @cpuinfo_model end |
#host_bootid ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/atatus/metadata/system_info/hw_info.rb', line 10 def host_bootid @host_bootid end |
#meminfo_total ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/atatus/metadata/system_info/hw_info.rb', line 10 def meminfo_total @meminfo_total end |
Class Method Details
.read! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/atatus/metadata/system_info/hw_info.rb', line 29 def self.read! new.read! end |
Instance Method Details
#cpuinfo ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:disable Metrics/MethodLength
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/atatus/metadata/system_info/hw_info.rb', line 34 def cpuinfo @cpuinfo ||= begin cpuinfo = { cores: @cpuinfo_cores, model: @cpuinfo_model } cpuinfo[:mhz] = @cpuinfo_mhz unless @cpuinfo_mhz.nil? cpuinfo end end |
#hostid ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:disable Metrics/MethodLength
53 54 55 56 57 58 59 |
# File 'lib/atatus/metadata/system_info/hw_info.rb', line 53 def hostid @hostid ||= begin return Socket.gethostname if @host_bootid.nil? @host_bootid end end |
#meminfo ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:enable Metrics/MethodLength
48 49 50 |
# File 'lib/atatus/metadata/system_info/hw_info.rb', line 48 def meminfo @meminfo ||= @meminfo_total end |
#read! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/atatus/metadata/system_info/hw_info.rb', line 17 def read! if @os =~ /(linux)/i read_from_cpuinfo! read_from_meminfo! read_from_bootid! elsif @os =~ /(darwin)/i read_cpuinfo_from_sysctl! read_meminfo_from_sysctl! end self end |