Class Bio::FlatFile::Splitter::Template
In: lib/bio/io/flatfile/splitter.rb
Parent: Object

This is a template of splitter.

Methods

Attributes

entry  [R]  the last entry string read from the stream (String)
entry  [W]  the last entry string read from the stream
entry_ended_pos  [W]  (end position of the entry) + 1
entry_ended_pos  [R]  (end position of the entry) + 1
entry_pos_flag  [RW]  a flag to write down entry start and end positions
entry_start_pos  [W]  start position of the entry
entry_start_pos  [R]  start position of the entry
parsed_entry  [R]  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.
parsed_entry  [W]  the last entry as a parsed data object

Public Class methods

Creates a new splitter.

[Source]

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

Public Instance methods

Gets entry as a string. (String)

[Source]

    # File lib/bio/io/flatfile/splitter.rb, line 47
47:         def get_entry
48:           raise NotImplementedError
49:         end

Gets entry as a data class‘s object

[Source]

    # File lib/bio/io/flatfile/splitter.rb, line 52
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 the stream

[Source]

    # File lib/bio/io/flatfile/splitter.rb, line 42
42:         def rewind
43:           @stream.rewind
44:         end

skips leader of the entry.

[Source]

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

[Validate]