Class: Net::NNTP::OverviewInformation

Inherits:
ArticleBaseResponse show all
Includes:
BodyBaseResponse
Defined in:
lib/net/nntp/response.rb

Overview

Code: 224

Instance Attribute Summary collapse

Attributes inherited from ArticleBaseResponse

#message_id, #number, #raw

Attributes inherited from Response

#code, #message, #request

Instance Method Summary collapse

Methods included from BodyBaseResponse

#body, #body=

Methods inherited from ArticleBaseResponse

#initialize

Methods inherited from Response

#==, #body, class_from_code, create, #force_close?, #generic?, #has_body?, #initialize, #multiline?, #needs_article?

Constructor Details

This class inherits a constructor from Net::NNTP::ArticleBaseResponse

Instance Attribute Details

#bytesObject (readonly)

Returns the value of attribute bytes.



406
407
408
# File 'lib/net/nntp/response.rb', line 406

def bytes
  @bytes
end

#dateObject (readonly)

Returns the value of attribute date.



406
407
408
# File 'lib/net/nntp/response.rb', line 406

def date
  @date
end

#fromObject (readonly)

Returns the value of attribute from.



406
407
408
# File 'lib/net/nntp/response.rb', line 406

def from
  @from
end

#linesObject (readonly)

Returns the value of attribute lines.



406
407
408
# File 'lib/net/nntp/response.rb', line 406

def lines
  @lines
end

#optional_headersObject (readonly)

Returns the value of attribute optional_headers.



406
407
408
# File 'lib/net/nntp/response.rb', line 406

def optional_headers
  @optional_headers
end

#referencesObject (readonly)

Returns the value of attribute references.



406
407
408
# File 'lib/net/nntp/response.rb', line 406

def references
  @references
end

#subjectObject (readonly)

Returns the value of attribute subject.



406
407
408
# File 'lib/net/nntp/response.rb', line 406

def subject
  @subject
end

Instance Method Details

#parse_bodyObject



407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/net/nntp/response.rb', line 407

def parse_body
  raw = @raw.gsub(/\r\n\.\r\n/, '')
  number, subject, from, date, message_id, references, bytes, lines, *rest =
    raw.strip.split(/\t/)
  @number = number.to_i
  @subject = subject
  @from = from
  @date = DateTime.parse(date)
  @message_id = message_id
  @references = references.split(/\s/)
  @bytes = bytes.to_i
  @lines = lines.to_i
  @optional_headers = {}
  if rest 
    rest.each do |line|
      header, value = line.split(/:\s+/)
      optional_headers[header.downcase] = value
    end
  end
end