Class: Kanrisuru::Core::Zypper::Parser::PatchCheck

Inherits:
Base
  • Object
show all
Defined in:
lib/kanrisuru/core/zypper/parsers/patch_check.rb

Class Method Summary collapse

Methods inherited from Base

extract_single_zypper_line

Class Method Details

.parse(command) ⇒ Object



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

def self.parse(command)
  lines = command.to_a

  rows = []
  lines.each do |line|
    next if line == ''

    values = line.split(' | ')
    next if values.length != 3

    values = values.map(&:strip)
    next if values[0] == 'Category'

    rows << Kanrisuru::Core::Zypper::PatchCount.new(
      values[0],
      values[1].to_i,
      values[2].to_i
    )
  end

  rows
end