Class: AmdgpuFan::StatSet

Inherits:
Hash
  • Object
show all
Defined in:
lib/amdgpu_fan/stat_set.rb

Overview

A set of stats

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(unit) ⇒ StatSet

Returns a new instance of StatSet.



9
10
11
# File 'lib/amdgpu_fan/stat_set.rb', line 9

def initialize(unit)
  @unit = unit
end

Instance Attribute Details

#avgObject

Returns the value of attribute avg.



6
7
8
# File 'lib/amdgpu_fan/stat_set.rb', line 6

def avg
  @avg
end

#maxObject

Returns the value of attribute max.



6
7
8
# File 'lib/amdgpu_fan/stat_set.rb', line 6

def max
  @max
end

#minObject

Returns the value of attribute min.



6
7
8
# File 'lib/amdgpu_fan/stat_set.rb', line 6

def min
  @min
end

#nowObject

Returns the value of attribute now.



6
7
8
# File 'lib/amdgpu_fan/stat_set.rb', line 6

def now
  @now
end

#unitObject (readonly)

Returns the value of attribute unit.



7
8
9
# File 'lib/amdgpu_fan/stat_set.rb', line 7

def unit
  @unit
end

Instance Method Details

#statsObject



13
14
15
# File 'lib/amdgpu_fan/stat_set.rb', line 13

def stats
  { min: min, avg: avg, max: max, now: now }
end

#to_sObject

Return a string containing all the stats with units.



20
21
22
# File 'lib/amdgpu_fan/stat_set.rb', line 20

def to_s
  stats.map { |k,v| "#{k}: #{v.to_s.rjust(6)} #{unit.ljust(3)} " }.join
end