jmay
3/20/2007 6:56:00 PM
Hi-
I'm trying to define a class with semantics similar to Fixnum, where
every object is unique. Each object has some internal state, more
complex that a single numeric value. Also, I want this to work across
marshalling and YAML.load. Semantics like this:
Foo.new("stuff").object_id == Foo.new("stuff").object_id
Foo.new("stuff").object_id ==
YAML.load(Foo.new("stuff").to_yaml).object_id
I looked at Memoize, but this just memoizes results of method calls on
instances, I couldn't figure out how to memoize #new.
I'm stumped. Any suggestions?
Thanks,
-Jason