class Procps::Memsize
The column type for a memsize
column.
Constants
- SUFFIXES
Public Class Methods
call(value)
click to toggle source
# File lib/procps/column_types/memsize.rb, line 6 def self.call(value) new(value) end
new(value)
click to toggle source
Calls superclass method
# File lib/procps/column_types/memsize.rb, line 12 def initialize(value) super(value.to_i * 1024) end
Public Instance Methods
human()
click to toggle source
# File lib/procps/column_types/memsize.rb, line 16 def human step = 0 output = __getobj__.to_f while output > 1024 step += 1 output = output / 1024 break if step == SUFFIXES.size end fmt = output == output.to_i ? "%d%s" : "%.2f%s" format(fmt, output, SUFFIXES[step]) end
Also aliased as: inspect