Class: Net::NNTP::GroupSelected

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

Overview

Code: 211

GroupSelected response.

See Group, Listgroup.

Instance Attribute Summary collapse

Attributes inherited from Response

#code, #message, #request

Instance Method Summary collapse

Methods included from BodyBaseResponse

#body, #body=

Methods inherited from Response

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

Constructor Details

#initialize(request, code, message) ⇒ GroupSelected

Returns a new instance of GroupSelected.

Raises:



254
255
256
257
258
259
260
261
# File 'lib/net/nntp/response.rb', line 254

def initialize(request, code, message)
  @group = OpenStruct.new
  tokens = message.split
  raise ProtocolError, "Malformed group message: #{message}" unless tokens.size >= 4
  @group.number, @group.low, @group.high, @group.name = tokens[0].to_i, tokens[1].to_i, tokens[2].to_i, tokens[3]
  @body = nil
  super request, code, message, false, Listgroup === request
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



251
252
253
# File 'lib/net/nntp/response.rb', line 251

def group
  @group
end

#listObject (readonly)

Returns the value of attribute list.



251
252
253
# File 'lib/net/nntp/response.rb', line 251

def list
  @list
end

#rawObject (readonly)

Returns the value of attribute raw.



252
253
254
# File 'lib/net/nntp/response.rb', line 252

def raw
  @raw
end

Instance Method Details

#parse_bodyObject



262
263
264
265
# File 'lib/net/nntp/response.rb', line 262

def parse_body
  @body=@raw
  @list = @raw.gsub(/\r?\n\.\r?\n/, '').split(/\r?\n/)
end