Class: ForemanMaintain::Utils::Disk::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/foreman_maintain/utils/disk/stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStats

Returns a new instance of Stats.



7
8
9
# File 'lib/foreman_maintain/utils/disk/stats.rb', line 7

def initialize
  @data = {}
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



5
6
7
# File 'lib/foreman_maintain/utils/disk/stats.rb', line 5

def data
  @data
end

Instance Method Details

#<<(io_obj) ⇒ Object



11
12
13
# File 'lib/foreman_maintain/utils/disk/stats.rb', line 11

def <<(io_obj)
  data[io_obj.dir] = io_obj.performance
end

#stdoutObject



15
16
17
18
19
20
21
# File 'lib/foreman_maintain/utils/disk/stats.rb', line 15

def stdout
  if data.keys.length > 1
    data.map { |dir, perf| "#{dir} : #{perf}" }.join("\n")
  else
    "Disk speed : #{data.values.first}"
  end
end