Class: RubyGPG2::StatusLines::KeyConsidered

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

Constant Summary collapse

FLAGS =
{
  '0' => [],
  '1' => [:key_not_selected],
  '2' => [:all_subkeys_expired_or_revoked]
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ KeyConsidered

Returns a new instance of KeyConsidered.



27
28
29
30
31
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 27

def initialize(opts)
  @raw = opts[:raw]
  @key_fingerprint = opts[:key_fingerprint]
  @flags = opts[:flags]
end

Instance Attribute Details

#flagsObject (readonly)

Returns the value of attribute flags.



21
22
23
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 21

def flags
  @flags
end

#key_fingerprintObject (readonly)

Returns the value of attribute key_fingerprint.



21
22
23
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 21

def key_fingerprint
  @key_fingerprint
end

#rawObject (readonly)

Returns the value of attribute raw.



21
22
23
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 21

def raw
  @raw
end

Class Method Details

.parse(line) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 12

def self.parse(line)
  match = line.match(/^\[GNUPG:\] KEY_CONSIDERED (.*) (.*)$/)
  new(
    raw: line,
    key_fingerprint: match[1],
    flags: FLAGS[match[2]]
  )
end

Instance Method Details

#==(other) ⇒ Object



37
38
39
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 37

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

#typeObject



33
34
35
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 33

def type
  :key_considered
end