Class: RubyGPG2::Key

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_gpg2/key.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Key

Returns a new instance of Key.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ruby_gpg2/key.rb', line 18

def initialize(opts)
  @type = opts[:type]
  @validity = opts[:validity]
  @length = opts[:length]
  @algorithm = opts[:algorithm]
  @id = opts[:id]
  @creation_date = opts[:creation_date]
  @owner_trust = opts[:owner_trust]
  @capabilities = opts[:capabilities]
  @serial_number = opts[:serial_number]
  @compliance_modes = opts[:compliance_modes]
  @origin = opts[:origin]
  @fingerprint = opts[:fingerprint]
  @user_ids = opts[:user_ids]
end

Instance Attribute Details

#algorithmObject (readonly)

Returns the value of attribute algorithm.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def algorithm
  @algorithm
end

#capabilitiesObject (readonly)

Returns the value of attribute capabilities.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def capabilities
  @capabilities
end

#compliance_modesObject (readonly)

Returns the value of attribute compliance_modes.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def compliance_modes
  @compliance_modes
end

#creation_dateObject (readonly)

Returns the value of attribute creation_date.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def creation_date
  @creation_date
end

#fingerprintObject (readonly)

Returns the value of attribute fingerprint.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def fingerprint
  @fingerprint
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def id
  @id
end

#lengthObject (readonly)

Returns the value of attribute length.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def length
  @length
end

#originObject (readonly)

Returns the value of attribute origin.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def origin
  @origin
end

#owner_trustObject (readonly)

Returns the value of attribute owner_trust.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def owner_trust
  @owner_trust
end

#serial_numberObject (readonly)

Returns the value of attribute serial_number.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def serial_number
  @serial_number
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def type
  @type
end

#user_idsObject (readonly)

Returns the value of attribute user_ids.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def user_ids
  @user_ids
end

#validityObject (readonly)

Returns the value of attribute validity.



3
4
5
# File 'lib/ruby_gpg2/key.rb', line 3

def validity
  @validity
end

Instance Method Details

#==(other) ⇒ Object



38
39
40
# File 'lib/ruby_gpg2/key.rb', line 38

def ==(other)
  other.class == self.class && other.state == state
end

#primary_user_idObject



34
35
36
# File 'lib/ruby_gpg2/key.rb', line 34

def primary_user_id
  @user_ids&.first
end