Class: RubyGPG2::StatusLines::KeyCreated
- Inherits:
-
Object
- Object
- RubyGPG2::StatusLines::KeyCreated
- Defined in:
- lib/ruby_gpg2/status_lines/key_created.rb
Constant Summary collapse
- KEY_TYPES =
{ 'B' => :primary_and_subkey, 'P' => :primary, 'S' => :subkey }.freeze
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
-
#key_fingerprint ⇒ Object
readonly
Returns the value of attribute key_fingerprint.
-
#key_type ⇒ Object
readonly
Returns the value of attribute key_type.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(opts) ⇒ KeyCreated
constructor
A new instance of KeyCreated.
- #type ⇒ Object
Constructor Details
#initialize(opts) ⇒ KeyCreated
Returns a new instance of KeyCreated.
29 30 31 32 33 34 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 29 def initialize(opts) @raw = opts[:raw] @key_type = opts[:key_type] @key_fingerprint = opts[:key_fingerprint] @handle = opts[:handle] end |
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
22 23 24 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 22 def handle @handle end |
#key_fingerprint ⇒ Object (readonly)
Returns the value of attribute key_fingerprint.
22 23 24 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 22 def key_fingerprint @key_fingerprint end |
#key_type ⇒ Object (readonly)
Returns the value of attribute key_type.
22 23 24 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 22 def key_type @key_type end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
22 23 24 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 22 def raw @raw end |
Class Method Details
.parse(line) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 12 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 |
Instance Method Details
#==(other) ⇒ Object
40 41 42 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 40 def ==(other) other.class == self.class && other.state == state end |
#type ⇒ Object
36 37 38 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 36 def type :key_created end |