From: Patrick Hurley Date: 2005-12-21T02:38:06+09:00 Subject: Re: Shelve module in Ruby? On 12/20/05, Bryan wrote: > The shelve module is a method for packaging a dictionary (hash) of > arbritrary objects into a file. I use it as a rudimentary database so > that I don't have to rebuild objects from text files over and over. Something like yaml? If I understand your request this is pretty close: require 'yaml' # arbitrary value (in this case a hash) hash = { :foo => :bar, 'answer' => 42 } # save it to a file File.open( 'test.yaml', 'w') { |out| out.puts hash.to_yaml } # read it back from a file new_hash = YAML::load( File.open( 'test.yaml' )) # show that they are equal p hash p new_hash If you are curious the file is a readable text file: --- answer: 42 :foo: :bar HIHI pth