Class: Radfish::SystemInfo
- Inherits:
-
Object
- Object
- Radfish::SystemInfo
- Defined in:
- lib/radfish/system_info.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #controllers ⇒ Object
- #cpus ⇒ Object
- #fans ⇒ Object
- #health ⇒ Object
-
#initialize(client) ⇒ SystemInfo
constructor
A new instance of SystemInfo.
- #keys ⇒ Object
- #make ⇒ Object
- #memory ⇒ Object
- #model ⇒ Object
- #nics ⇒ Object
-
#psus ⇒ Object
Removed temperatures - not universally supported.
- #serial ⇒ Object
- #service_tag ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(client) ⇒ SystemInfo
Returns a new instance of SystemInfo.
7 8 9 10 |
# File 'lib/radfish/system_info.rb', line 7 def initialize(client) @client = client @cache = {} end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/radfish/system_info.rb', line 5 def client @client end |
Instance Method Details
#controllers ⇒ Object
64 65 66 |
# File 'lib/radfish/system_info.rb', line 64 def controllers @cache[:controllers] ||= @client.controllers end |
#cpus ⇒ Object
38 39 40 |
# File 'lib/radfish/system_info.rb', line 38 def cpus @cache[:cpus] ||= @client.adapter.cpus end |
#fans ⇒ Object
50 51 52 |
# File 'lib/radfish/system_info.rb', line 50 def fans @cache[:fans] ||= @client.adapter.fans end |
#health ⇒ Object
60 61 62 |
# File 'lib/radfish/system_info.rb', line 60 def health @cache[:health] ||= @client.adapter.system_health end |
#keys ⇒ Object
12 13 14 |
# File 'lib/radfish/system_info.rb', line 12 def keys [:service_tag, :make, :model, :serial, :cpus, :memory, :nics, :fans, :psus, :health, :controllers] end |
#make ⇒ Object
26 27 28 |
# File 'lib/radfish/system_info.rb', line 26 def make @cache[:make] ||= @client.adapter.make end |
#memory ⇒ Object
42 43 44 |
# File 'lib/radfish/system_info.rb', line 42 def memory @cache[:memory] ||= @client.adapter.memory end |
#model ⇒ Object
30 31 32 |
# File 'lib/radfish/system_info.rb', line 30 def model @cache[:model] ||= @client.adapter.model end |
#nics ⇒ Object
46 47 48 |
# File 'lib/radfish/system_info.rb', line 46 def nics @cache[:nics] ||= @client.adapter.nics end |
#psus ⇒ Object
Removed temperatures - not universally supported
56 57 58 |
# File 'lib/radfish/system_info.rb', line 56 def psus @cache[:psus] ||= @client.adapter.psus end |
#serial ⇒ Object
34 35 36 |
# File 'lib/radfish/system_info.rb', line 34 def serial @cache[:serial] ||= @client.adapter.serial end |
#service_tag ⇒ Object
22 23 24 |
# File 'lib/radfish/system_info.rb', line 22 def service_tag @cache[:service_tag] ||= @client.adapter.service_tag end |
#to_h ⇒ Object
16 17 18 19 20 |
# File 'lib/radfish/system_info.rb', line 16 def to_h keys.each_with_object({}) do |key, hash| hash[key] = send(key) end end |