Skip to content

Commit

Permalink
.to_a instead of .each with a block
Browse files Browse the repository at this point in the history
  • Loading branch information
vlewin committed Aug 3, 2015
1 parent 8806270 commit b7210d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/suse/connect/zypper.rb
Expand Up @@ -45,7 +45,7 @@ def disable_repository(name)
def repositories
zypper_out = call('--xmlout --non-interactive repos -d', false)
xml_doc = REXML::Document.new(zypper_out, compress_whitespace: [])
xml_doc.elements.each('stream/repo-list/repo') {}.map {|r| r.to_hash.merge!(url: r.elements['url'].text) }
xml_doc.elements.to_a('stream/repo-list/repo').map {|r| r.to_hash.merge!(url: r.elements['url'].text) }
end

# @param service_url [String] url to appropriate repomd.xml to be fed to zypper
Expand All @@ -70,7 +70,7 @@ def remove_service(service_name)
def find_products(identifier)
zypper_out = call("--xmlout --non-interactive search -s -t product #{identifier}", false)
xml_doc = REXML::Document.new(zypper_out, compress_whitespace: [])
xml_doc.elements.each('stream/search-result/solvable-list/solvable') {}.map(&:to_hash)
xml_doc.elements.to_a('stream/search-result/solvable-list/solvable').map(&:to_hash)
end

##
Expand All @@ -97,7 +97,7 @@ def remove_service_credentials(service_name)
def services
zypper_out = call('--xmlout --non-interactive services -d', false)
xml_doc = REXML::Document.new(zypper_out, compress_whitespace: [])
xml_doc.elements.each('stream/service-list/service') {}.map(&:to_hash)
xml_doc.elements.to_a('stream/service-list/service').map(&:to_hash)
end

def refresh
Expand Down

0 comments on commit b7210d9

Please sign in to comment.