Sha256: 21fa526a6848cba3c7d3d0b0527f149628ec72e1ef3b429ebde585bd1e787b85

Contents?: true

Size: 529 Bytes

Versions: 15

Compression:

Stored size: 529 Bytes

Contents

module Rmpd
  class ResponseSplitter

    def self.split(lines, responses=[])
      known_keys = []
      response_lines = []

      lines.each do |line|
        if KEY_VALUE_RE === line
          key, value = $~.values_at(1..2)
          if known_keys.include?(key)
            yield responses, response_lines
            response_lines.clear
            known_keys.clear
          end

          response_lines << line
          known_keys << key
        end
      end

      yield responses, response_lines
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rmpd-1.1.16 lib/rmpd/response_splitter.rb
rmpd-1.1.15 lib/rmpd/response_splitter.rb
rmpd-1.1.13 lib/rmpd/response_splitter.rb
rmpd-1.1.12 lib/rmpd/response_splitter.rb
rmpd-1.1.11 lib/rmpd/response_splitter.rb
rmpd-1.1.9 lib/rmpd/response_splitter.rb
rmpd-1.1.8 lib/rmpd/response_splitter.rb
rmpd-1.1.7 lib/rmpd/response_splitter.rb
rmpd-1.1.6 lib/rmpd/response_splitter.rb
rmpd-1.1.5 lib/rmpd/response_splitter.rb
rmpd-1.1.4 lib/rmpd/response_splitter.rb
rmpd-1.1.3 lib/rmpd/response_splitter.rb
rmpd-1.1.2 lib/rmpd/response_splitter.rb
rmpd-1.1.1 lib/rmpd/response_splitter.rb
rmpd-1.1.0 lib/rmpd/response_splitter.rb