Sha256: 1606ac0b69b344b2c8cfdfa80370e99028371f7e9e21b8ae49956c954596cc53
Contents?: true
Size: 809 Bytes
Versions: 2
Compression:
Stored size: 809 Bytes
Contents
require 'gpg_status_parser/status_codes' require 'gpg_status_parser/arguments' module GPGStatusParser class NotGPGStatus < StandardError end class InvalidStatus < StandardError end class StatusMessage COMMAND_REGEXP = /^\[GNUPG:\] ([^ ]+)(?: (.*))?$/ attr_reader :status, :args 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gpg_status_parser-0.4.0 | lib/gpg_status_parser/status_message.rb |
gpg_status_parser-0.3.0 | lib/gpg_status_parser/status_message.rb |