Class: Kanrisuru::Core::Disk::Parser::Du

Inherits:
Object
  • Object
show all
Defined in:
lib/kanrisuru/core/disk/parsers/du.rb

Class Method Summary collapse

Class Method Details

.parse(command, convert) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/kanrisuru/core/disk/parsers/du.rb', line 9

def parse(command, convert)
  lines = command.to_a

  lines.map do |line|
    values = line.split
    size = values[0].to_i
    size = convert ? Kanrisuru::Util::Bits.convert_bytes(size, :byte, convert) : size

    Kanrisuru::Core::Disk::DiskUsage.new(size, values[1])
  end
end