Class: AmdgpuFan::StatSet
- Inherits:
-
Hash
- Object
- Hash
- AmdgpuFan::StatSet
- Defined in:
- lib/amdgpu_fan/stat_set.rb
Overview
A set of stats
Instance Attribute Summary collapse
-
#avg ⇒ Object
Returns the value of attribute avg.
-
#max ⇒ Object
Returns the value of attribute max.
-
#min ⇒ Object
Returns the value of attribute min.
-
#now ⇒ Object
Returns the value of attribute now.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
Instance Method Summary collapse
-
#initialize(unit) ⇒ StatSet
constructor
A new instance of StatSet.
- #stats ⇒ Object
-
#to_s ⇒ Object
Return a string containing all the stats with units.
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
#avg ⇒ Object
Returns the value of attribute avg.
6 7 8 |
# File 'lib/amdgpu_fan/stat_set.rb', line 6 def avg @avg end |
#max ⇒ Object
Returns the value of attribute max.
6 7 8 |
# File 'lib/amdgpu_fan/stat_set.rb', line 6 def max @max end |
#min ⇒ Object
Returns the value of attribute min.
6 7 8 |
# File 'lib/amdgpu_fan/stat_set.rb', line 6 def min @min end |
#now ⇒ Object
Returns the value of attribute now.
6 7 8 |
# File 'lib/amdgpu_fan/stat_set.rb', line 6 def now @now end |
#unit ⇒ Object (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
#stats ⇒ Object
13 14 15 |
# File 'lib/amdgpu_fan/stat_set.rb', line 13 def stats { min: min, avg: avg, max: max, now: now } end |
#to_s ⇒ Object
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 |