class Bio::FlatFile::Splitter::Template

This is a template of splitter.

Attributes

entry[RW]

the last entry string read from the stream (String)

entry_ended_pos[RW]

(end position of the entry) + 1

entry_pos_flag[RW]

a flag to write down entry start and end positions

entry_start_pos[RW]

start position of the entry

parsed_entry[RW]

The last parsed entry read from the stream (entry data class). Note that it is valid only after get_parsed_entry is called, and the get_entry may not affect the parsed_entry attribute.

Public Class Methods

new(klass, bstream) click to toggle source

Creates a new splitter.

   # File lib/bio/io/flatfile/splitter.rb
30 def initialize(klass, bstream)
31   @dbclass = klass
32   @stream = bstream
33   @entry_pos_flag = nil
34 end

Public Instance Methods

get_entry() click to toggle source

Gets entry as a string. (String)

   # File lib/bio/io/flatfile/splitter.rb
47 def get_entry
48   raise NotImplementedError
49 end
get_parsed_entry() click to toggle source

Gets entry as a data class's object

   # File lib/bio/io/flatfile/splitter.rb
52 def get_parsed_entry
53   ent = get_entry
54   if ent then
55     self.parsed_entry = dbclass.new(ent)
56   else
57     self.parsed_entry = ent
58   end
59   parsed_entry
60 end
rewind() click to toggle source

rewind the stream

   # File lib/bio/io/flatfile/splitter.rb
42 def rewind
43   @stream.rewind
44 end
skip_leader() click to toggle source

skips leader of the entry.

   # File lib/bio/io/flatfile/splitter.rb
37 def skip_leader
38   raise NotImplementedError
39 end