Class: YumRepo::PackageList
- Inherits:
-
Object
- Object
- YumRepo::PackageList
- Defined in:
- lib/yumrepo.rb
Instance Method Summary collapse
- #all ⇒ Object
- #each ⇒ Object
-
#initialize(url) ⇒ PackageList
constructor
A new instance of PackageList.
Constructor Details
#initialize(url) ⇒ PackageList
Returns a new instance of PackageList.
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/yumrepo.rb', line 157 def initialize(url) @url = url @xml_file = Repomd.new(url).primary @packages = [] buf = '' YumRepo.bench("Zlib::GzipReader.read") do buf = Zlib::GzipReader.new(@xml_file).read end YumRepo.bench("Building Package Objects") do d = Nokogiri::XML::Reader(buf) d.each do |n| if n.name == 'package' and not n.node_type == Nokogiri::XML::Reader::TYPE_END_ELEMENT @packages << Package.new(n.outer_xml) end end end end |
Instance Method Details
#all ⇒ Object
183 184 185 |
# File 'lib/yumrepo.rb', line 183 def all @packages end |
#each ⇒ Object
177 178 179 180 181 |
# File 'lib/yumrepo.rb', line 177 def each all.each do |p| yield p end end |