Class: RubyGPG2::StatusLines::ImportProblem

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

Constant Summary collapse

REASONS =
{
  0 => :no_reason_given,
  1 => :invalid_certificate,
  2 => :issuer_certificate_missing,
  3 => :certificate_chain_too_long,
  4 => :error_storing_certificate
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ ImportProblem

Returns a new instance of ImportProblem.



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

def initialize(opts)
  @raw = opts[:raw]
  @reason = opts[:reason]
  @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_problem.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_problem.rb', line 23

def raw
  @raw
end

#reasonObject (readonly)

Returns the value of attribute reason.



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

def reason
  @reason
end

Class Method Details

.parse(line) ⇒ Object



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

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

Instance Method Details

#==(other) ⇒ Object



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

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

#typeObject



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

def type
  :import_problem
end