Sha256: fa613f2f027f2297823107c7d6b04cc10ac4c84b1bcbb63d572839157e444ffb

Contents?: true

Size: 596 Bytes

Versions: 8

Compression:

Stored size: 596 Bytes

Contents

# frozen_string_literal: true

require_relative 'status_lines'

module RubyGPG2
  class StatusLine
    TYPE_REGEX = /^\[GNUPG:\] (.*?)(\s|$)/.freeze

    TYPES = {
      'IMPORT_OK' => StatusLines::ImportOK,
      'IMPORT_PROBLEM' => StatusLines::ImportProblem,
      'IMPORTED' => StatusLines::Imported,
      'KEY_CREATED' => StatusLines::KeyCreated,
      'KEY_CONSIDERED' => StatusLines::KeyConsidered
    }.freeze

    def self.parse(line)
      TYPES
        .fetch(
          line.match(TYPE_REGEX)[1],
          StatusLines::Unimplemented
        )
        .parse(line)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruby_gpg2-0.11.0.pre.4 lib/ruby_gpg2/status_line.rb
ruby_gpg2-0.11.0.pre.3 lib/ruby_gpg2/status_line.rb
ruby_gpg2-0.11.0.pre.2 lib/ruby_gpg2/status_line.rb
ruby_gpg2-0.11.0.pre.1 lib/ruby_gpg2/status_line.rb
ruby_gpg2-0.10.0 lib/ruby_gpg2/status_line.rb
ruby_gpg2-0.9.0.pre.9 lib/ruby_gpg2/status_line.rb
ruby_gpg2-0.9.0.pre.8 lib/ruby_gpg2/status_line.rb
ruby_gpg2-0.9.0.pre.7 lib/ruby_gpg2/status_line.rb