Class: NntpScrape::Commands::Group

Inherits:
Base
  • Object
show all
Defined in:
lib/nntp_scrape/commands/group.rb

Constant Summary collapse

PARSER =
/^(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/

Instance Attribute Summary collapse

Attributes inherited from Base

#lines, #response, #status_line, #timeout

Instance Method Summary collapse

Methods inherited from Base

#continue?, #ran?, #run_long, #run_short, #status_code, #success?, supported?

Constructor Details

#initialize(group) ⇒ Group

Returns a new instance of Group.



10
11
12
# File 'lib/nntp_scrape/commands/group.rb', line 10

def initialize(group)
  @group = group
end

Instance Attribute Details

#article_countObject (readonly)

Returns the value of attribute article_count.



4
5
6
# File 'lib/nntp_scrape/commands/group.rb', line 4

def article_count
  @article_count
end

#high_idObject (readonly)

Returns the value of attribute high_id.



6
7
8
# File 'lib/nntp_scrape/commands/group.rb', line 6

def high_id
  @high_id
end

#low_idObject (readonly)

Returns the value of attribute low_id.



5
6
7
# File 'lib/nntp_scrape/commands/group.rb', line 5

def low_id
  @low_id
end

Instance Method Details

#execute(client) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/nntp_scrape/commands/group.rb', line 14

def execute(client)
  run_short client, "GROUP", @group
  
  if match = PARSER.match(status_line)
    @article_count = match[2]
    @low_id = match[3]
    @high_id = match[4]
  end
  
end