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.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dbnameObject (readonly)

Returns the value of attribute dbname.



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

def dbname
  @dbname
end

#fileObject (readonly)

Returns the value of attribute file.



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

def file
  @file
end

#nameObject (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

#closeObject



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

def close
  @file.close
end

#filenameObject

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

#include?(key) ⇒ Boolean

Returns:

  • (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

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

#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