Class: NntpScrape::Commands::Head
- Defined in:
- lib/nntp_scrape/commands/head.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
Attributes inherited from Base
#lines, #response, #status_line, #timeout
Instance Method Summary collapse
- #execute(client) ⇒ Object
-
#initialize(number = nil) ⇒ Head
constructor
A new instance of Head.
Methods inherited from Base
#continue?, #ran?, #run_long, #run_short, #status_code, #success?, supported?
Constructor Details
#initialize(number = nil) ⇒ Head
Returns a new instance of Head.
7 8 9 |
# File 'lib/nntp_scrape/commands/head.rb', line 7 def initialize(number=nil) @number = number end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/nntp_scrape/commands/head.rb', line 5 def data @data end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
4 5 6 |
# File 'lib/nntp_scrape/commands/head.rb', line 4 def @message_id end |
Instance Method Details
#execute(client) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/nntp_scrape/commands/head.rb', line 11 def execute(client) if @number.present? run_long client, "HEAD", @number else run_long client, "HEAD" end @message_id = status_line.split.last @data = {} lines.each do |line| key, value = *line.split(": ", 2) @data[key] = value end end |