Class: Warc::Stream::Plain

Inherits:
Warc::Stream show all
Defined in:
lib/warc/stream/plain.rb

Constant Summary

Constants inherited from Warc::Stream

DEFAULT_OPTS

Instance Attribute Summary

Attributes inherited from Warc::Stream

#parser

Instance Method Summary collapse

Methods inherited from Warc::Stream

#close, #each, #record, #size

Constructor Details

#initialize(fh, options = {}, &block) ⇒ Plain

Returns a new instance of Plain.



5
6
7
8
# File 'lib/warc/stream/plain.rb', line 5

def initialize(fh,options={},&block)
  @ext = '.warc'
  super(fh,options,&block)
end

Instance Method Details

#read_recordObject



10
11
12
13
14
15
16
# File 'lib/warc/stream/plain.rb', line 10

def read_record
  begin
    self.parser.parse(@file_handle)
  rescue EOFError # No more records
    return nil
  end
end

#write_record(record) ⇒ Object



18
19
20
21
# File 'lib/warc/stream/plain.rb', line 18

def write_record(record)
  super
  record.dump_to(@file_handle)
end