Class: Kanrisuru::Core::Zypper::Parser::ListPatches

Inherits:
Base
  • Object
show all
Defined in:
lib/kanrisuru/core/zypper/parsers/list_patches.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
30
31
32
33
34
35
# File 'lib/kanrisuru/core/zypper/parsers/list_patches.rb', line 8

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

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

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

    values = values.map(&:strip)
    next if values[0] == 'Repository' && values[6] == 'Summary'

    rows << Kanrisuru::Core::Zypper::PatchUpdate.new(
      values[0],
      values[1],
      values[2],
      values[3],
      values[4] == '---' ? '' : values[4],
      values[5],
      values[6]
    )
  end

  rows
end