Class: Bio::GFFbrowser::Digest::NoCacheHelpers::SeekRecList
- Inherits:
-
Object
- Object
- Bio::GFFbrowser::Digest::NoCacheHelpers::SeekRecList
- Defined in:
- lib/bio/db/gff/digest/gffnocache.rb
Overview
Helper class which gives Hash-like access to the no-cache GFF3 file
Instance Method Summary collapse
- #[](id) ⇒ Object
- #[]=(id, rec) ⇒ Object
- #each ⇒ Object
-
#initialize(fh, parser) ⇒ SeekRecList
constructor
A new instance of SeekRecList.
Constructor Details
#initialize(fh, parser) ⇒ SeekRecList
Returns a new instance of SeekRecList.
38 39 40 41 42 |
# File 'lib/bio/db/gff/digest/gffnocache.rb', line 38 def initialize fh, parser @fh = fh @h = {} @parser = parser end |
Instance Method Details
#[](id) ⇒ Object
50 51 52 53 |
# File 'lib/bio/db/gff/digest/gffnocache.rb', line 50 def [](id) fpos = @h[id] SeekRec::fetch(@fh,fpos,@parser) end |
#[]=(id, rec) ⇒ Object
44 45 46 47 48 |
# File 'lib/bio/db/gff/digest/gffnocache.rb', line 44 def []= id, rec raise "id #{id} occurs twice!" if @h[id] fpos = rec.io_seek @h[id] = fpos end |
#each ⇒ Object
55 56 57 58 59 |
# File 'lib/bio/db/gff/digest/gffnocache.rb', line 55 def each @h.each do | id,fpos | yield id, self[id] end end |