acts like a hash with an initialization block, but saves any newly-created value even upon lookup.
for example:
class C
attr_accessor :val def initialize; @val = 0 end
end
h = Hash.new { C.new } h.val # => 0 h.val = 1 h.val # => 0
h2 = SavingHash.new { C.new } h2.val # => 0 h2.val = 1 h2.val # => 1
important note: you REALLY want to use member? to test existence, because just checking h will always evaluate to true (except for degenerate constructor blocks that return nil or false)
Generated with the Darkfish Rdoc Generator 2.