Class | Bio::FlatFileIndex::BDBwrapper
In: | lib/bio/io/flatfile/bdb.rb
Parent: | Object

### Methods

[] []= close filename keys new open writeback_array

### Public Class methods

new(name, filename, *arg)

[Source]

        # File lib/bio/io/flatfile/bdb.rb, line 44
    44:       def initialize(name, filename, *arg)
    45:         @dbname = name
    46:         @file = nil
    47:         @filename = filename
    48:         #self.open(*arg)
    49:       end

### Public Instance methods

[](arg)

[Source]

        # File lib/bio/io/flatfile/bdb.rb, line 73
    73:       def [](arg)
    74:         #self.open
    75:         if @file then
    76:           @file[arg]
    77:         else
    78:           nil
    79:         end
    80:       end

[]=(key, val)

[Source]

        # File lib/bio/io/flatfile/bdb.rb, line 82
    82:       def []=(key, val)
    83:         #self.open
    84:         @file[key.to_s] = val.to_s
    85:       end

close()

[Source]

        # File lib/bio/io/flatfile/bdb.rb, line 64
    64:       def close
    65:         if @file
    66:           DEBUG.print "BDBwrapper: close #{filename}\n"
    67:           @file.close
    68:           @file = nil
    69:         end
    70:         nil
    71:       end

filename()

[Source]

        # File lib/bio/io/flatfile/bdb.rb, line 51
    51:       def filename
    52:         File.join(@dbname, @filename)
    53:       end

keys()

[Source]

         # File lib/bio/io/flatfile/bdb.rb, line 95
     95:       def keys
     96:         if @file then
     97:           @file.keys
     98:         else
     99:           []
    100:         end
    101:       end

open(flag = BDBdefault.flag_read, permission = BDBdefault.permission)

[Source]

        # File lib/bio/io/flatfile/bdb.rb, line 55
    55:       def open(flag = BDBdefault.flag_read,
    56:                permission = BDBdefault.permission)
    57:         unless @file then
    58:           DEBUG.print "BDBwrapper: open #{filename}\n"
    59:           @file = BDB::Btree.open(filename, nil, flag, permission)
    60:         end
    61:         true
    62:       end

writeback_array(prefix, array, *arg)

[Source]

        # File lib/bio/io/flatfile/bdb.rb, line 87
    87:       def writeback_array(prefix, array, *arg)
    88:         self.close
    89:         self.open(*arg)
    90:         array.each_with_index do |val, key|
    91:           @file["#{prefix}#{key}"] = val.to_s
    92:         end
    93:       end

[Validate]