Class: YumRepo::Package
- Inherits:
-
Object
- Object
- YumRepo::Package
- Defined in:
- lib/yumrepo.rb
Instance Method Summary collapse
- #description ⇒ Object
- #doc ⇒ Object
- #group ⇒ Object
-
#initialize(xml) ⇒ Package
constructor
A new instance of Package.
- #license ⇒ Object
- #location ⇒ Object
- #name ⇒ Object
- #provides ⇒ Object
- #release ⇒ Object
- #requires ⇒ Object
- #src_rpm ⇒ Object
- #summary ⇒ Object
- #url ⇒ Object
- #vendor ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(xml) ⇒ Package
Returns a new instance of Package.
227 228 229 |
# File 'lib/yumrepo.rb', line 227 def initialize(xml) @xml = xml end |
Instance Method Details
#description ⇒ Object
243 244 245 |
# File 'lib/yumrepo.rb', line 243 def description doc.xpath('/xmlns:package/xmlns:description').text.strip end |
#doc ⇒ Object
231 232 233 |
# File 'lib/yumrepo.rb', line 231 def doc @doc ||= Nokogiri::XML(@xml) end |
#group ⇒ Object
267 268 269 |
# File 'lib/yumrepo.rb', line 267 def group doc.xpath('/xmlns:package/xmlns:format/rpm:group').text.strip end |
#license ⇒ Object
275 276 277 |
# File 'lib/yumrepo.rb', line 275 def license doc.xpath('/xmlns:package/xmlns:format/rpm:license').text.strip end |
#location ⇒ Object
251 252 253 |
# File 'lib/yumrepo.rb', line 251 def location doc.xpath('/xmlns:package/xmlns:location/@href').text.strip end |
#name ⇒ Object
235 236 237 |
# File 'lib/yumrepo.rb', line 235 def name doc.xpath('/xmlns:package/xmlns:name').text.strip end |
#provides ⇒ Object
279 280 281 282 283 284 285 |
# File 'lib/yumrepo.rb', line 279 def provides doc.xpath('/xmlns:package/xmlns:format/rpm:provides/rpm:entry').map do |pr| { :name => pr.at_xpath('./@name').text.strip } end end |
#release ⇒ Object
259 260 261 |
# File 'lib/yumrepo.rb', line 259 def release doc.xpath('/xmlns:package/xmlns:version/@rel').text.strip end |
#requires ⇒ Object
287 288 289 290 291 292 293 |
# File 'lib/yumrepo.rb', line 287 def requires doc.xpath('/xmlns:package/xmlns:format/rpm:requires/rpm:entry').map do |pr| { :name => pr.at_xpath('./@name').text.strip } end end |
#src_rpm ⇒ Object
263 264 265 |
# File 'lib/yumrepo.rb', line 263 def src_rpm doc.xpath('/xmlns:package/xmlns:format/rpm:sourcerpm').text.strip end |
#summary ⇒ Object
239 240 241 |
# File 'lib/yumrepo.rb', line 239 def summary doc.xpath('/xmlns:package/xmlns:summary').text.strip end |
#url ⇒ Object
247 248 249 |
# File 'lib/yumrepo.rb', line 247 def url doc.xpath('/xmlns:package/xmlns:url').text.strip end |
#vendor ⇒ Object
271 272 273 |
# File 'lib/yumrepo.rb', line 271 def vendor doc.xpath('/xmlns:package/xmlns:format/rpm:vendor').text.strip end |
#version ⇒ Object
255 256 257 |
# File 'lib/yumrepo.rb', line 255 def version doc.xpath('/xmlns:package/xmlns:version/@ver').text.strip end |