Class: GPGStatusParser::StatusMessage
- Inherits:
-
Object
- Object
- GPGStatusParser::StatusMessage
- Defined in:
- lib/gpg_status_parser/status_message.rb
Constant Summary collapse
- COMMAND_REGEXP =
/^\[GNUPG:\] ([^ ]+)(?: (.*))?$/
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status_string) ⇒ StatusMessage
constructor
A new instance of StatusMessage.
Constructor Details
#initialize(status_string) ⇒ StatusMessage
Returns a new instance of StatusMessage.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gpg_status_parser/status_message.rb', line 17 def initialize status_string match = COMMAND_REGEXP.match(status_string) raise NotGPGStatus if match.nil? @status = match[1].intern raise InvalidStatus, @status if !STATUS_CODES.keys.include?(@status) expected_arg_string = GPGStatusParser::STATUS_CODES[@status] expected_args = GPGStatusParser::Arguments.extract_expected_arguments(expected_arg_string) @args = GPGStatusParser::Arguments.extract_argument_values(expected_args, match[2]) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
15 16 17 |
# File 'lib/gpg_status_parser/status_message.rb', line 15 def args @args end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
15 16 17 |
# File 'lib/gpg_status_parser/status_message.rb', line 15 def status @status end |