Class: Radfish::SystemInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/radfish/system_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (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

#controllersObject



64
65
66
# File 'lib/radfish/system_info.rb', line 64

def controllers
  @cache[:controllers] ||= @client.controllers
end

#cpusObject



38
39
40
# File 'lib/radfish/system_info.rb', line 38

def cpus
  @cache[:cpus] ||= @client.adapter.cpus
end

#fansObject



50
51
52
# File 'lib/radfish/system_info.rb', line 50

def fans
  @cache[:fans] ||= @client.adapter.fans
end

#healthObject



60
61
62
# File 'lib/radfish/system_info.rb', line 60

def health
  @cache[:health] ||= @client.adapter.system_health
end

#keysObject



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

#makeObject



26
27
28
# File 'lib/radfish/system_info.rb', line 26

def make
  @cache[:make] ||= @client.adapter.make
end

#memoryObject



42
43
44
# File 'lib/radfish/system_info.rb', line 42

def memory
  @cache[:memory] ||= @client.adapter.memory
end

#modelObject



30
31
32
# File 'lib/radfish/system_info.rb', line 30

def model
  @cache[:model] ||= @client.adapter.model
end

#nicsObject



46
47
48
# File 'lib/radfish/system_info.rb', line 46

def nics
  @cache[:nics] ||= @client.adapter.nics
end

#psusObject

Removed temperatures - not universally supported



56
57
58
# File 'lib/radfish/system_info.rb', line 56

def psus
  @cache[:psus] ||= @client.adapter.psus
end

#serialObject



34
35
36
# File 'lib/radfish/system_info.rb', line 34

def serial
  @cache[:serial] ||= @client.adapter.serial
end

#service_tagObject



22
23
24
# File 'lib/radfish/system_info.rb', line 22

def service_tag
  @cache[:service_tag] ||= @client.adapter.service_tag
end

#to_hObject



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