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

rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ruby_gpg2/key.rb', line 23

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.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def algorithm
  @algorithm
end

#capabilitiesObject (readonly)

Returns the value of attribute capabilities.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def capabilities
  @capabilities
end

#compliance_modesObject (readonly)

Returns the value of attribute compliance_modes.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def compliance_modes
  @compliance_modes
end

#creation_dateObject (readonly)

Returns the value of attribute creation_date.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def creation_date
  @creation_date
end

#fingerprintObject (readonly)

Returns the value of attribute fingerprint.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def fingerprint
  @fingerprint
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def id
  @id
end

#lengthObject (readonly)

Returns the value of attribute length.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def length
  @length
end

#originObject (readonly)

Returns the value of attribute origin.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def origin
  @origin
end

#owner_trustObject (readonly)

Returns the value of attribute owner_trust.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def owner_trust
  @owner_trust
end

#serial_numberObject (readonly)

Returns the value of attribute serial_number.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def serial_number
  @serial_number
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def type
  @type
end

#user_idsObject (readonly)

Returns the value of attribute user_ids.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def user_ids
  @user_ids
end

#validityObject (readonly)

Returns the value of attribute validity.



5
6
7
# File 'lib/ruby_gpg2/key.rb', line 5

def validity
  @validity
end

Instance Method Details

#==(other) ⇒ Object



45
46
47
# File 'lib/ruby_gpg2/key.rb', line 45

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

#primary_user_idObject

rubocop:enable Metrics/AbcSize rubocop:enable Metrics/MethodLength



41
42
43
# File 'lib/ruby_gpg2/key.rb', line 41

def primary_user_id
  @user_ids&.first
end