Class: Net::NNTP::Listgroup
- Inherits:
-
SelectionRequest
- Object
- Request
- SelectionRequest
- Net::NNTP::Listgroup
- Defined in:
- lib/net/nntp/request.rb
Overview
LISTGROUP request.
Parent: Net::NNTP::SelectionRequest
Valid Responses: GroupSelected, GroupUnknown, NoGroupSelected
Instance Method Summary collapse
-
#initialize(groupname = nil, range = {}) ⇒ Listgroup
constructor
groupnameis the group that should be selected.
Methods inherited from SelectionRequest
Methods inherited from Request
#capability, #command, #dotstuff, #msgid_or_range, #range, #valid_response?
Constructor Details
#initialize(groupname = nil, range = {}) ⇒ Listgroup
groupnameis the group that should be selected. If a name is given, the group will be selected; on success, the first article returned will be selected. If no name is given, the currently selected group will be used, and no range can be specified.rangea range of article numbers in the specified group, given as Hash with the keys :start and :end; if :end is not specified, the range is seen as 'open range', thus selecting all articles beginning with the number given as :start value to the last number available in the group.
Usage Example
# no groupname
request = Net::NNTP::Listgroup.new
# request.command => 'LISTGROUP'
# only groupname
request = Net::NNTP::Listgroup.new('alt.test')
# request.command => 'LISTGROUP alt.test'
# given only a start number
request = Net::NNTP::Listgroup.new('alt.test', :start => 1000)
# request.command => 'LISTGROUP alt.test 1000-'
# given a range
request = Net::NNTP::Listgroup.new('alt.test', :start => 1000, :end => 5000)
# request.command => 'LISTGROUP alt.test 1000- 5000'
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
# File 'lib/net/nntp/request.rb', line 331 def initialize(groupname=nil, range={}) param = nil if groupname then param = groupname unless range.empty? if range.has_key?(:start) if range.has_key?(:end) param = "#{groupname} #{range[:start]}-#{range[:end]}" else param = "#{groupname} #{range[:start]}-" end end end end super 'LISTGROUP', param end |