Class: NntpScrape::Commands::Xover

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

Instance Attribute Summary collapse

Attributes inherited from Base

#lines, #response, #status_line, #timeout

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

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

Constructor Details

#initialize(range) ⇒ Xover

Returns a new instance of Xover.



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

def initialize(range)
  @range = range
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



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

def results
  @results
end

Class Method Details

.supported?(client) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.supported?(client)
  client.caps.include? "XOVER"
end

Instance Method Details

#execute(client) ⇒ Object



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

def execute(client)
  if @range.is_a? Range
    run_long client, "XOVER", "#{@range.begin}-#{@range.end}"
  else
    run_long client, "XOVER", @range         
  end
  
  @results = @lines.map{|l| l.split("\t")}
end