Class: Kanrisuru::Core::Zypper::Parser::ListRepos
- Inherits:
-
Base
- Object
- Base
- Kanrisuru::Core::Zypper::Parser::ListRepos
show all
- Defined in:
- lib/kanrisuru/core/zypper/parsers/list_repos.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
|
# File 'lib/kanrisuru/core/zypper/parsers/list_repos.rb', line 8
def self.parse(command)
lines = command.to_a
rows = []
lines.each do |line|
next unless line.match(/^\d/)
values = line.split('|')
values = values.map(&:strip)
rows << Kanrisuru::Core::Zypper::Repo.new(
values[0].to_i,
values[1],
values[2],
values[3] == 'Yes',
values[4].include?('Yes'),
values[5] == 'Yes',
values[6].to_i,
values[7],
values[8],
values.length == 10 ? values[9] : nil
)
end
rows
end
|