Class: Rnp::UserID
- Inherits:
-
Object
- Object
- Rnp::UserID
- Defined in:
- lib/rnp/userid.rb
Overview
Class that represents a UserID
Instance Attribute Summary collapse
- #ptr ⇒ Object readonly private
Class Method Summary collapse
- .destroy(ptr) ⇒ Object private
Instance Method Summary collapse
-
#each_signature(&block) ⇒ self, Enumerator
Enumerate each Signature for this key.
-
#initialize(ptr, userid) ⇒ UserID
constructor
private
A new instance of UserID.
- #inspect ⇒ Object
-
#revoked? ⇒ Boolean
Check if this key is revoked.
-
#signatures ⇒ Array<Signature>
Get a list of all Signatures for this key.
- #to_s ⇒ Object
Constructor Details
#initialize(ptr, userid) ⇒ UserID
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of UserID.
19 20 21 22 23 |
# File 'lib/rnp/userid.rb', line 19 def initialize(ptr, userid) raise Rnp::Error, 'NULL pointer' if ptr.null? @ptr = FFI::AutoPointer.new(ptr, self.class.method(:destroy)) @userid = userid end |
Instance Attribute Details
#ptr ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/rnp/userid.rb', line 16 def ptr @ptr end |
Class Method Details
.destroy(ptr) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/rnp/userid.rb', line 26 def self.destroy(ptr) LibRnp.rnp_uid_handle_destroy(ptr) end |
Instance Method Details
#each_signature(&block) ⇒ self, Enumerator
Enumerate each Signature for this key.
41 42 43 44 45 |
# File 'lib/rnp/userid.rb', line 41 def each_signature(&block) block or return enum_for(:signature_iterator) signature_iterator(&block) self end |
#inspect ⇒ Object
30 31 32 |
# File 'lib/rnp/userid.rb', line 30 def inspect Rnp.inspect_ptr(self) end |
#revoked? ⇒ Boolean
Check if this key is revoked.
57 58 59 60 61 |
# File 'lib/rnp/userid.rb', line 57 def revoked? presult = FFI::MemoryPointer.new(:bool) Rnp.call_ffi(:rnp_uid_is_revoked, @ptr, presult) presult.read(:bool) end |
#signatures ⇒ Array<Signature>
Get a list of all Signatures for this key.
50 51 52 |
# File 'lib/rnp/userid.rb', line 50 def signatures each_signature.to_a end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/rnp/userid.rb', line 34 def to_s @userid end |