Class: RPM::Problem

Inherits:
Object
  • Object
show all
Defined in:
lib/rpm/problem.rb

Class Method Summary collapse

Instance Method Summary collapse

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

.release(ptr) ⇒ Object



6
7
8
# File 'lib/rpm/problem.rb', line 6

def self.release(ptr)
  RPM::C.rpmProblemFree(ptr)
end

Instance Method Details

#<=>(other) ⇒ Fixnum



60
61
62
# File 'lib/rpm/problem.rb', line 60

def <=>(other)
  RPM::C.rpmProblemCompare(@ptr, other.ptr)
end

#keyString



45
46
47
# File 'lib/rpm/problem.rb', line 45

def key
  RPM::C.rpmProblemGetKey(@ptr).read_string
end

#strString



50
51
52
# File 'lib/rpm/problem.rb', line 50

def str
  RPM::C.rpmProblemGetStr(@ptr)
end

#to_sString



55
56
57
# File 'lib/rpm/problem.rb', line 55

def to_s
  RPM::C.rpmProblemString(@ptr)
end

#typeRPM::ProblemType



40
41
42
# File 'lib/rpm/problem.rb', line 40

def type
  RPM::C.rpmProblemGetType(@ptr)
end