Module: Net::NNTPHeaderParser

Included in:
NNTPArticle, NNTPArticleResponse, NNTPHeadResponse
Defined in:
lib/net/nntp/response/parsers.rb

Constant Summary collapse

HEADER_PARSE_RE =
/(.*):\s(.*)/i

Instance Method Summary collapse

Instance Method Details

#parse_headers(raw_headers) ⇒ Object


53
54
55
56
57
58
59
60
61
62
63
# File 'lib/net/nntp/response/parsers.rb', line 53

def parse_headers(raw_headers)
  headers = {}
  raw_headers.to_s.each_line do |line|
    line.chomp!
    k = line[HEADER_PARSE_RE, 1]
    v = line[HEADER_PARSE_RE, 2]
    headers[k] = v
  end

  headers
end