Class: Bio::FlatFileIndex::Template::NameSpace
- Defined in:
- lib/bio/io/flatfile/index.rb
Overview
templates of namespace
Internal use only.
Direct Known Subclasses
BDB_1::PrimaryNameSpace, BDB_1::SecondaryNameSpace, Flat_1::PrimaryNameSpace, Flat_1::SecondaryNameSpace
Instance Attribute Summary collapse
-
#dbname ⇒ Object
readonly
Returns the value of attribute dbname.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #close ⇒ Object
- #filename ⇒ Object
- #include?(key) ⇒ Boolean
-
#initialize(dbname, name) ⇒ NameSpace
constructor
A new instance of NameSpace.
- #mapping(filename) ⇒ Object
- #search(key) ⇒ Object
Constructor Details
#initialize(dbname, name) ⇒ NameSpace
Returns a new instance of NameSpace.
457 458 459 460 461 462 |
# File 'lib/bio/io/flatfile/index.rb', line 457 def initialize(dbname, name) @dbname = dbname @name = name.dup @name.freeze @file = mapping(filename) end |
Instance Attribute Details
#dbname ⇒ Object (readonly)
Returns the value of attribute dbname.
463 464 465 |
# File 'lib/bio/io/flatfile/index.rb', line 463 def dbname @dbname end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
463 464 465 |
# File 'lib/bio/io/flatfile/index.rb', line 463 def file @file end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
463 464 465 |
# File 'lib/bio/io/flatfile/index.rb', line 463 def name @name end |
Instance Method Details
#close ⇒ Object
470 471 472 |
# File 'lib/bio/io/flatfile/index.rb', line 470 def close @file.close end |
#filename ⇒ Object
446 447 448 449 |
# File 'lib/bio/io/flatfile/index.rb', line 446 def filename # should be redifined in child class raise NotImplementedError, "should be redefined in child class" end |
#include?(key) ⇒ Boolean
474 475 476 477 478 479 480 481 |
# File 'lib/bio/io/flatfile/index.rb', line 474 def include?(key) r = search(key) unless r.empty? then key else nil end end |
#mapping(filename) ⇒ Object
451 452 453 454 455 |
# File 'lib/bio/io/flatfile/index.rb', line 451 def mapping(filename) # should be redifined in child class raise NotImplementedError, "should be redefined in child class" #Flat_1::FlatMappingFile.new(filename) end |
#search(key) ⇒ Object
465 466 467 468 |
# File 'lib/bio/io/flatfile/index.rb', line 465 def search(key) @file.open @file.search(key) end |