Class: Radfish::ThermalInfo

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ThermalInfo

Returns a new instance of ThermalInfo.



7
8
9
10
# File 'lib/radfish/thermal_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/thermal_info.rb', line 5

def client
  @client
end

Instance Method Details

#fansObject



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

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

#keysObject



12
13
14
# File 'lib/radfish/thermal_info.rb', line 12

def keys
  [:fans]
end

#to_hObject



16
17
18
19
20
# File 'lib/radfish/thermal_info.rb', line 16

def to_h
  keys.each_with_object({}) do |key, hash|
    hash[key] = send(key) rescue nil
  end
end