class Bio::FlatFileIndex::BDBwrapper
Public Class Methods
new(name, filename, *arg)
click to toggle source
# File lib/bio/io/flatfile/bdb.rb, line 44 def initialize(name, filename, *arg) @dbname = name @file = nil @filename = filename #self.open(*arg) end
Public Instance Methods
[](arg)
click to toggle source
# File lib/bio/io/flatfile/bdb.rb, line 73 def [](arg) #self.open if @file then @file[arg] else nil end end
[]=(key, val)
click to toggle source
# File lib/bio/io/flatfile/bdb.rb, line 82 def []=(key, val) #self.open @file[key.to_s] = val.to_s end
close()
click to toggle source
# File lib/bio/io/flatfile/bdb.rb, line 64 def close if @file DEBUG.print "BDBwrapper: close #{filename}\n" @file.close @file = nil end nil end
filename()
click to toggle source
# File lib/bio/io/flatfile/bdb.rb, line 51 def filename File.join(@dbname, @filename) end
keys()
click to toggle source
# File lib/bio/io/flatfile/bdb.rb, line 95 def keys if @file then @file.keys else [] end end
open(flag = BDBdefault.flag_read, permission = BDBdefault.permission)
click to toggle source
# File lib/bio/io/flatfile/bdb.rb, line 55 def open(flag = BDBdefault.flag_read, permission = BDBdefault.permission) unless @file then DEBUG.print "BDBwrapper: open #{filename}\n" @file = BDB::Btree.open(filename, nil, flag, permission) end true end
writeback_array(prefix, array, *arg)
click to toggle source
# File lib/bio/io/flatfile/bdb.rb, line 87 def writeback_array(prefix, array, *arg) self.close self.open(*arg) array.each_with_index do |val, key| @file["#{prefix}#{key}"] = val.to_s end end