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
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ ImportOK

Returns a new instance of ImportOK.



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

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.



23
24
25
# File 'lib/ruby_gpg2/status_lines/import_ok.rb', line 23

def key_fingerprint
  @key_fingerprint
end

#rawObject (readonly)

Returns the value of attribute raw.



23
24
25
# File 'lib/ruby_gpg2/status_lines/import_ok.rb', line 23

def raw
  @raw
end

#reasonsObject (readonly)

Returns the value of attribute reasons.



23
24
25
# File 'lib/ruby_gpg2/status_lines/import_ok.rb', line 23

def reasons
  @reasons
end

Class Method Details

.parse(line) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/ruby_gpg2/status_lines/import_ok.rb', line 14

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



39
40
41
# File 'lib/ruby_gpg2/status_lines/import_ok.rb', line 39

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

#typeObject



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

def type
  :import_ok
end