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, line 30
def initialize(klass, bstream)
  @dbclass = klass
  @stream = bstream
  @entry_pos_flag = nil
end

Public Instance Methods

get_entry() click to toggle source

Gets entry as a string. (String)

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

Gets entry as a data class's object

# File lib/bio/io/flatfile/splitter.rb, line 52
def get_parsed_entry
  ent = get_entry
  if ent then
    self.parsed_entry = dbclass.new(ent)
  else
    self.parsed_entry = ent
  end
  parsed_entry
end
rewind() click to toggle source

rewind the stream

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

skips leader of the entry.

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