Sha256: 1895dcb2b21b01c2e5dd9e12ea5761fe64c96b366e860a804908584dd65609fd
Contents?: true
Size: 1.01 KB
Versions: 16
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true module RubyGPG2 module StatusLines class KeyCreated KEY_TYPES = { 'B' => :primary_and_subkey, 'P' => :primary, 'S' => :subkey }.freeze def self.parse(line) match = line.match(/^\[GNUPG:\] KEY_CREATED (.) (.*?)(?: (.*))?$/) new( raw: line, key_type: KEY_TYPES[match[1]], key_fingerprint: match[2], handle: match[3] ) end attr_reader( :raw, :key_type, :key_fingerprint, :handle ) def initialize(opts) @raw = opts[:raw] @key_type = opts[:key_type] @key_fingerprint = opts[:key_fingerprint] @handle = opts[:handle] end def type :key_created end def ==(other) other.class == self.class && other.state == state end protected def state [ @raw, @key_type, @key_fingerprint ] end end end end
Version data entries
16 entries across 16 versions & 1 rubygems