Hello, Guy.
Something I don't understand is happening with Marshal in bdb-0.2.9.  

First I'll describe my mental model of what I believe should be happening, 
then you can correct that model: (1) dump should be invoked each time a 
record is written, (2) load should be invoked each time a record is read. (3) 
the record, when read should be an exact copy of the record written, with the 
same behaviour.

Yet, as can be seen in the code below, bdb does not return a record with the 
same behaviour as the record that was written.  I would greatly appreciate it 
if you could correct my understanding of what should be happening and explain 
why.  Thanks ahead for your reply.

require 'bdb'

class SortedBtree < BDB::Btree
    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

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 = SortedBtree.create('sbtree.bdb')
hash = Hash.new

fileRecord = Record.new
hashRecord = Record.new

fileRecord.string = theString
hashRecord.string = theString

file['One'] = fileRecord		#<==dump invoked here--OK
hash['One'] = Marshal.dump(hashRecord)

fileRecord = file['One']
hashRecord = Marshal.load(hash['One'])

p fileRecord.string.class		#<==dump invoked here--Why?
p hashRecord.string.class

puts 'file success' if fileRecord.string == theString  #<== here also
puts 'hash success'  if hashRecord.string == theString
#==== end code =======

<fileRecord.string> is of class String with a value of  'StringOne', yet is 
unequal  when compared to 'StringOne'--How is that possible?

>ruby testMarshal2.rb
====================
testMarshal2.rb:43:in `dump'
testMarshal2.rb:43:in `[]='
testMarshal2.rb:43
====================
testMarshal2.rb:44:in `dump'
testMarshal2.rb:44
====================
testMarshal2.rb:49:in `dump'
testMarshal2.rb:49:in `method_missing'
testMarshal2.rb:49
====================
testMarshal2.rb:49:in `dump'
testMarshal2.rb:49:in `method_missing'
testMarshal2.rb:49
String
String
====================
testMarshal2.rb:52:in `dump'
testMarshal2.rb:52:in `method_missing'
testMarshal2.rb:52
hash success
>Exit code: 0

-- 
Quantum Mechanics: The dreams stuff is made of