class RPM::Problem

Public Class Methods

create(type, pkg_nevr, key, alt_nevr, str, number) click to toggle source

Create a problem item. @param [RPM::ProblemType] type problem type @param [String] pkg_nver name-version-edition-release of the related package @param [String] key key of the related package @param [String] alt_nver name-version-edition-release of the other related package @param [String] str generic data string from a problem

# File lib/rpm/problem.rb, line 29
def self.create(type, pkg_nevr, key, alt_nevr, str, number)
  ptr = ::FFI::AutoPointer.new(RPM::C.rpmProblemCreate(type, pkg_nevr, key, alt_nevr, str, number), Problem.method(:release))
  new(ptr)
end
from_ptr(ptr) click to toggle source

Creates a problem from an existing C pointer, refcounting it first. @param [FFI::Pointer] ptr existing C pointer @return [RPM::Problem] wrapped object

# File lib/rpm/problem.rb, line 14
def self.from_ptr(ptr)
  case ptr
    when FFI::Pointer
      new(FFI::AutoPointer.new(RPM::C.rpmProblemLink(ptr), Problem.method(:release)))
    else
      raise "Can't initialize header with '#{ptr}'"
  end
end
new(ptr) click to toggle source

@visibility private

# File lib/rpm/problem.rb, line 35
def initialize(ptr)
  @ptr = ptr
end
release(ptr) click to toggle source
# File lib/rpm/problem.rb, line 6
def self.release(ptr)
  RPM::C.rpmProblemFree(ptr)
end

Public Instance Methods

<=>(other) click to toggle source

@return [Fixnum] compare two problems for equality.

# File lib/rpm/problem.rb, line 60
def <=>(other)
  RPM::C.rpmProblemCompare(@ptr, other.ptr)
end
key() click to toggle source

@return [String] filename or python object address of a problem.

# File lib/rpm/problem.rb, line 45
def key
  RPM::C.rpmProblemGetKey(@ptr).read_string
end
ptr() click to toggle source

@visibility private

# File lib/rpm/problem.rb, line 65
def ptr
  @ptr
end
str() click to toggle source

@return [String] a generic data string from a problem.

# File lib/rpm/problem.rb, line 50
def str
  RPM::C.rpmProblemGetStr(@ptr)
end
to_s() click to toggle source

@return [String] formatted string representation of a problem

# File lib/rpm/problem.rb, line 55
def to_s
  RPM::C.rpmProblemString(@ptr)
end
type() click to toggle source

@return [RPM::ProblemType] type of problem (dependency, diskpace etc).

# File lib/rpm/problem.rb, line 40
def type
  RPM::C.rpmProblemGetType(@ptr)
end