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
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?