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.
189 190 191 |
# File 'lib/yumrepo.rb', line 189 def initialize(xml) @xml = xml end |
Instance Method Details
#description ⇒ Object
205 206 207 |
# File 'lib/yumrepo.rb', line 205 def description doc.xpath('/xmlns:package/xmlns:description').text.strip end |
#doc ⇒ Object
193 194 195 |
# File 'lib/yumrepo.rb', line 193 def doc @doc ||= Nokogiri::XML(@xml) end |
#group ⇒ Object
229 230 231 |
# File 'lib/yumrepo.rb', line 229 def group doc.xpath('/xmlns:package/xmlns:format/rpm:group').text.strip end |
#license ⇒ Object
237 238 239 |
# File 'lib/yumrepo.rb', line 237 def license doc.xpath('/xmlns:package/xmlns:format/rpm:license').text.strip end |
#location ⇒ Object
213 214 215 |
# File 'lib/yumrepo.rb', line 213 def location doc.xpath('/xmlns:package/xmlns:location/@href').text.strip end |
#name ⇒ Object
197 198 199 |
# File 'lib/yumrepo.rb', line 197 def name doc.xpath('/xmlns:package/xmlns:name').text.strip end |
#provides ⇒ Object
241 242 243 244 245 246 247 |
# File 'lib/yumrepo.rb', line 241 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
221 222 223 |
# File 'lib/yumrepo.rb', line 221 def release doc.xpath('/xmlns:package/xmlns:version/@rel').text.strip end |
#requires ⇒ Object
249 250 251 252 253 254 255 |
# File 'lib/yumrepo.rb', line 249 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
225 226 227 |
# File 'lib/yumrepo.rb', line 225 def src_rpm doc.xpath('/xmlns:package/xmlns:format/rpm:sourcerpm').text.strip end |
#summary ⇒ Object
201 202 203 |
# File 'lib/yumrepo.rb', line 201 def summary doc.xpath('/xmlns:package/xmlns:summary').text.strip end |
#url ⇒ Object
209 210 211 |
# File 'lib/yumrepo.rb', line 209 def url doc.xpath('/xmlns:package/xmlns:url').text.strip end |
#vendor ⇒ Object
233 234 235 |
# File 'lib/yumrepo.rb', line 233 def vendor doc.xpath('/xmlns:package/xmlns:format/rpm:vendor').text.strip end |
#version ⇒ Object
217 218 219 |
# File 'lib/yumrepo.rb', line 217 def version doc.xpath('/xmlns:package/xmlns:version/@ver').text.strip end |