class YumRepo::PackageChangelog

Attributes

arch[R]
current_release[R]
current_version[R]
name[R]

Public Class Methods

new(xml) click to toggle source
# File lib/yumrepo.rb, line 344
def initialize(xml)
  doc = Nokogiri::XML(xml)
  doc.remove_namespaces!
  @name = doc.xpath('/package/@name').text.strip
  @arch = doc.xpath('/package/@arch').text.strip
  @current_version = doc.xpath('/package/version/@ver').text.strip
  @current_release = doc.xpath('/package/version/@rel').text.strip

  @releases = doc.xpath('/package/changelog').map do |pr|
    {
      :author => pr.at_xpath('./@author').text.strip,
      :version => _get_version_string(pr.at_xpath('./@author').text),
      :date => Time.at(pr.at_xpath('./@date').text.strip.to_i),
      :summary => pr.text.sub(/^- /, '')
    }
  end
end

Public Instance Methods

all() click to toggle source
# File lib/yumrepo.rb, line 368
def all
  @releases
end
each() { |r| ... } click to toggle source
# File lib/yumrepo.rb, line 362
def each
  all.each do |r|
    yield r
  end
end

Private Instance Methods

_get_version_string(input) click to toggle source
# File lib/yumrepo.rb, line 374
def _get_version_string(input)
  m = @@version_regex_std.match(input)
  return m[2].to_s.strip() if m

  m = @@version_regex_odd.match(input)
  return m[1].to_s.strip() if m
end