Class: Kanrisuru::Core::Disk::Parser::Df

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

Class Method Summary collapse

Class Method Details

.parse(command) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/kanrisuru/core/disk/parsers/df.rb', line 9

def parse(command)
  items = []
  rows = command.to_a
  rows.each.with_index do |row, index|
    next if index.zero?

    values = row.split

    items << Kanrisuru::Core::Disk::DiskFree.new(
      values[0],
      values[1],
      values[2].to_i,
      values[3].to_i,
      values[4].to_i,
      values[5]
    )
  end
  items
end