Class: Bio::FlatFileIndex::Template::NameSpace

Inherits:
Object
  • Object
show all
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)

Instance Method Summary (collapse)

Constructor Details

- (NameSpace) initialize(dbname, name)



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

- (Object) dbname (readonly)

Returns the value of attribute dbname



463
464
465
# File 'lib/bio/io/flatfile/index.rb', line 463

def dbname
  @dbname
end

- (Object) file (readonly)

Returns the value of attribute file



463
464
465
# File 'lib/bio/io/flatfile/index.rb', line 463

def file
  @file
end

- (Object) name (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

- (Object) close



470
471
472
# File 'lib/bio/io/flatfile/index.rb', line 470

def close
  @file.close
end

- (Object) filename

Raises:

  • (NotImplementedError)


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

- (Boolean) include?(key)



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

- (Object) mapping(filename)

Raises:

  • (NotImplementedError)


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

- (Object) search(key)



465
466
467
468
# File 'lib/bio/io/flatfile/index.rb', line 465

def search(key)
  @file.open
  @file.search(key)
end