Class: GPGME::UserID

Inherits:
Object
  • Object
show all
Defined in:
lib/gpgme/user_id.rb,
lib/gpgme/ffi/user_id.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



5
6
7
# File 'lib/gpgme/user_id.rb', line 5

def comment
  @comment
end

#emailObject (readonly)

Returns the value of attribute email.



5
6
7
# File 'lib/gpgme/user_id.rb', line 5

def email
  @email
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/gpgme/user_id.rb', line 5

def name
  @name
end

#signaturesObject (readonly)

Returns the value of attribute signatures.



5
6
7
# File 'lib/gpgme/user_id.rb', line 5

def signatures
  @signatures
end

#uidObject (readonly)

Returns the value of attribute uid.



5
6
7
# File 'lib/gpgme/user_id.rb', line 5

def uid
  @uid
end

#validityObject (readonly)

Returns the value of attribute validity.



5
6
7
# File 'lib/gpgme/user_id.rb', line 5

def validity
  @validity
end

Class Method Details

.new_from_struct(struct) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gpgme/ffi/user_id.rb', line 3

def self.new_from_struct(struct)
  instance = allocate

  instance.instance_exec do
    @revoked  = (struct[:flags] >> 0) & 1
    @invalid  = (struct[:flags] >> 1) & 1
    @validity = struct[:validity]
    @uid      = struct[:uid]
    @name     = struct[:name]
    @email    = struct[:email]
    @comment  = struct[:comment]

    @signatures = []
    pointer = struct[:signatures]

    until pointer.null?
      signature = Library::KeySig

      @signatures << KeySig.new_from_struct(signature)

      pointer = signature[:next]
    end
  end

  instance
end

Instance Method Details

#inspectObject



15
16
17
18
# File 'lib/gpgme/user_id.rb', line 15

def inspect
  "#<#{self.class} #{name} <#{email}> \
validity=#{VALIDITY_NAMES[validity]}, signatures=#{signatures.inspect}>"
end

#invalid?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/gpgme/user_id.rb', line 11

def invalid?
  @invalid == 1
end

#revoked?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/gpgme/user_id.rb', line 7

def revoked?
  @revoked == 1
end