Class: Bio::FlatFile::Splitter::Template
- Defined in:
- lib/bio/io/flatfile/splitter.rb
Overview
This is a template of splitter.
Direct Known Subclasses
Blast::RPSBlast::RPSBlastSplitter, Bio::Fasta::Report::FastaFormat10Splitter, Default, LineOriented
Instance Attribute Summary collapse
-
#entry ⇒ Object
readonly
the last entry string read from the stream (String).
-
#entry_ended_pos ⇒ Object
readonly
(end position of the entry) + 1.
-
#entry_pos_flag ⇒ Object
a flag to write down entry start and end positions.
-
#entry_start_pos ⇒ Object
readonly
start position of the entry.
-
#parsed_entry ⇒ Object
readonly
The last parsed entry read from the stream (entry data class).
Instance Method Summary collapse
-
#get_entry ⇒ Object
Gets entry as a string.
-
#get_parsed_entry ⇒ Object
Gets entry as a data class’s object.
-
#initialize(klass, bstream) ⇒ Template
constructor
Creates a new splitter.
-
#rewind ⇒ Object
rewind the stream.
-
#skip_leader ⇒ Object
skips leader of the entry.
Constructor Details
#initialize(klass, bstream) ⇒ Template
Creates a new splitter.
30 31 32 33 34 |
# File 'lib/bio/io/flatfile/splitter.rb', line 30 def initialize(klass, bstream) @dbclass = klass @stream = bstream @entry_pos_flag = nil end |
Instance Attribute Details
#entry ⇒ Object
the last entry string read from the stream (String)
63 64 65 |
# File 'lib/bio/io/flatfile/splitter.rb', line 63 def entry @entry end |
#entry_ended_pos ⇒ Object
(end position of the entry) + 1
77 78 79 |
# File 'lib/bio/io/flatfile/splitter.rb', line 77 def entry_ended_pos @entry_ended_pos end |
#entry_pos_flag ⇒ Object
a flag to write down entry start and end positions
71 72 73 |
# File 'lib/bio/io/flatfile/splitter.rb', line 71 def entry_pos_flag @entry_pos_flag end |
#entry_start_pos ⇒ Object
start position of the entry
74 75 76 |
# File 'lib/bio/io/flatfile/splitter.rb', line 74 def entry_start_pos @entry_start_pos end |
#parsed_entry ⇒ Object
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.
68 69 70 |
# File 'lib/bio/io/flatfile/splitter.rb', line 68 def parsed_entry @parsed_entry end |
Instance Method Details
#get_entry ⇒ Object
Gets entry as a string. (String)
47 48 49 |
# File 'lib/bio/io/flatfile/splitter.rb', line 47 def get_entry raise NotImplementedError end |
#get_parsed_entry ⇒ Object
Gets entry as a data class’s object
52 53 54 55 56 57 58 59 60 |
# 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 ⇒ Object
rewind the stream
42 43 44 |
# File 'lib/bio/io/flatfile/splitter.rb', line 42 def rewind @stream.rewind end |
#skip_leader ⇒ Object
skips leader of the entry.
37 38 39 |
# File 'lib/bio/io/flatfile/splitter.rb', line 37 def skip_leader raise NotImplementedError end |