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 }
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.
25 26 27 28 29 30 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 25 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.
19 20 21 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 19 def handle @handle end |
#key_fingerprint ⇒ Object (readonly)
Returns the value of attribute key_fingerprint.
19 20 21 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 19 def key_fingerprint @key_fingerprint end |
#key_type ⇒ Object (readonly)
Returns the value of attribute key_type.
19 20 21 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 19 def key_type @key_type end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
19 20 21 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 19 def raw @raw end |
Class Method Details
.parse(line) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 10 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
36 37 38 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 36 def ==(other) other.class == self.class && other.state == state end |
#type ⇒ Object
32 33 34 |
# File 'lib/ruby_gpg2/status_lines/key_created.rb', line 32 def type :key_created end |