each loop on Berkeley DB Databases
require 'bdb'
db = BDB::Btree.create('e.db', nil, BDB::CREATE)
db['earth'] = 'M'
db['water'] = 'A'
db['air'] = 's'
db['fire'] = 'P'
db.each { |k,v| puts k }
puts db['water']
db.close
Related examples in the same category