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]
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ KeyConsidered

Returns a new instance of KeyConsidered.



23
24
25
26
27
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 23

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.



18
19
20
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 18

def flags
  @flags
end

#key_fingerprintObject (readonly)

Returns the value of attribute key_fingerprint.



18
19
20
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 18

def key_fingerprint
  @key_fingerprint
end

#rawObject (readonly)

Returns the value of attribute raw.



18
19
20
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 18

def raw
  @raw
end

Class Method Details

.parse(line) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/ruby_gpg2/status_lines/key_considered.rb', line 10

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



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

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

#typeObject



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

def type
  :key_considered
end