Sha256: b25d83760ab9bff1a7b93cd25f591d952f0ddef0123c43c75b528425742656eb

Contents?: true

Size: 490 Bytes

Versions: 2

Compression:

Stored size: 490 Bytes

Contents

require 'gpg_status_parser/status_message'

module GPGStatusParser

  # Parse a single line
  def self.parse_line(line)
    GPGStatusParser::StatusMessage.new(line.strip)
  end

  # Takes a file or string and optional block and either yields or
  # returns a list of status messages
  def self.parse(file_or_string, &block)
    if block
      file_or_string.each_line { |line| yield parse_line(line)}
    else
      file_or_string.each_line.map{ |line| parse_line(line)}
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gpg_status_parser-0.3.0 lib/gpg_status_parser.rb
gpg_status_parser-0.2.0 lib/gpg_status_parser.rb