From: "Albert L. Wagner" Date: 2002-01-23T01:34:04+09:00 Subject: Re: Problem with Marshal in bdb-0.2.9 Sorry, Guy. That change causes the following output: >ruby testMarshal3.rb "#" testMarshal3.rb:39: undefined method `string' for "#":String (NameError) >Exit code: 1 It's apparently not calling or <_dump> As a workaround I have overridden the <[]>, <[]=>, and instance methods and invoked Marshal explicitly in these methods. require 'bdb' module BDB class SortedBtree < Btree extend Marshal def SortedBtree.create(fileName) super(fileName, nil, BDB::CREATE | BDB::TRUNCATE, 0644, 'set_pagesize' => 1024, 'set_bt_compare' => proc{|a,b|a <=> b}) #'marshal' => true) end end # class SortedBtree end class Record attr_accessor(:string) def Record._load(str) rec = new rec.string = str rec end def _dump(depth) puts '====================' puts caller.join("\n") self.string end end theString = 'StringOne' file = BDB::SortedBtree.create('sbtree.bdb') fileRecord = Record.new fileRecord.string = theString file['One'] = fileRecord fileRecord = file['One'] p fileRecord p fileRecord.string.class puts (fileRecord.string == theString ? 'success' : 'failure') -- "It requires wisdom to understand wisdom: the music is nothing if the audience is deaf." - Walter Lippman