Sha256: 6c17a21bcafbc34091db6eb291a09eb67e01592dd5e1382cb0dfca1e450e05fa
Contents?: true
Size: 542 Bytes
Versions: 2
Compression:
Stored size: 542 Bytes
Contents
#!/usr/bin/ruby require 'bdb1' module BDB1 class Btreesort < Btree def bdb1_bt_compare(a, b) b.downcase <=> a.downcase end end end a = { "gamma" => 4, "Alpha" => 1, "delta" => 3, "Beta" => 2, "delta" => 3} db = BDB1::Btreesort.open "tmp/alpha", "w" a.each do |x, y| db[x] = y end db.each do |x, y| puts "SORT : #{x} -- #{y}" end db = BDB1::Hash.open "tmp/alpha", "w", "set_h_hash" => lambda { |x| x.hash } a.each do |x, y| puts "#{x} -- #{y}" db[x] = y end db.each do |x, y| puts "HASH : #{x} -- #{y}" end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bdb1-0.2.5 | examples/func.rb |
bdb1-0.2.4 | examples/func.rb |