Class: RubyGPG2::StatusLines::ImportOK

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

Constant Summary collapse

REASONS =
{
    1 => :new_key,
    2 => :new_user_ids,
    4 => :new_signatures,
    8 => :new_subkeys,
    16 => :private_key
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ ImportOK

Returns a new instance of ImportOK.



25
26
27
28
29
# File 'lib/ruby_gpg2/status_lines/import_ok.rb', line 25

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

Instance Attribute Details

#key_fingerprintObject (readonly)

Returns the value of attribute key_fingerprint.



20
21
22
# File 'lib/ruby_gpg2/status_lines/import_ok.rb', line 20

def key_fingerprint
  @key_fingerprint
end

#rawObject (readonly)

Returns the value of attribute raw.



20
21
22
# File 'lib/ruby_gpg2/status_lines/import_ok.rb', line 20

def raw
  @raw
end

#reasonsObject (readonly)

Returns the value of attribute reasons.



20
21
22
# File 'lib/ruby_gpg2/status_lines/import_ok.rb', line 20

def reasons
  @reasons
end

Class Method Details

.parse(line) ⇒ Object



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

def self.parse(line)
  match = line.match(/^\[GNUPG:\] IMPORT_OK (\d+) (.*)$/)
  new(
      raw: line,
      reasons: reasons(match[1]),
      key_fingerprint: match[2])
end

Instance Method Details

#==(other) ⇒ Object



35
36
37
# File 'lib/ruby_gpg2/status_lines/import_ok.rb', line 35

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

#typeObject



31
32
33
# File 'lib/ruby_gpg2/status_lines/import_ok.rb', line 31

def type
  :import_ok
end