Class: RPM::Problem
- Inherits:
-
Object
- Object
- RPM::Problem
- Defined in:
- lib/rpm/problem.rb
Class Method Summary collapse
-
.create(type, pkg_nevr, key, alt_nevr, str, number) ⇒ Object
Create a problem item.
-
.from_ptr(ptr) ⇒ RPM::Problem
Creates a problem from an existing C pointer, refcounting it first.
- .release(ptr) ⇒ Object
Instance Method Summary collapse
-
#<=>(other) ⇒ Fixnum
Compare two problems for equality.
-
#key ⇒ String
Filename or python object address of a problem.
-
#str ⇒ String
A generic data string from a problem.
-
#to_s ⇒ String
Formatted string representation of a problem.
-
#type ⇒ RPM::ProblemType
Type of problem (dependency, diskpace etc).
Class Method Details
.create(type, pkg_nevr, key, alt_nevr, str, number) ⇒ Object
Create a problem item.
29 30 31 32 |
# 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) ⇒ RPM::Problem
Creates a problem from an existing C pointer, refcounting it first.
14 15 16 17 18 19 20 21 |
# 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 |
Instance Method Details
#<=>(other) ⇒ Fixnum
Returns compare two problems for equality.
60 61 62 |
# File 'lib/rpm/problem.rb', line 60 def <=>(other) RPM::C.rpmProblemCompare(@ptr, other.ptr) end |
#key ⇒ String
Returns filename or python object address of a problem.
45 46 47 |
# File 'lib/rpm/problem.rb', line 45 def key RPM::C.rpmProblemGetKey(@ptr).read_string end |
#str ⇒ String
Returns a generic data string from a problem.
50 51 52 |
# File 'lib/rpm/problem.rb', line 50 def str RPM::C.rpmProblemGetStr(@ptr) end |