Robert Klemme
4/4/2005 6:17:00 AM
"Dmitry V. Sabanin" <sdmitry@lrn.ru> schrieb im Newsbeitrag
news:200504041340.17940.sdmitry@lrn.ru...
> Sorry to reply myself, but maybe that will help: when I'm trying to
> Marshal::dump instance, it raises: "Foo can't be referred"
Then you need to make sure that Foo is actually defined when you do
Marshal.load(). Maybe you didn't require it in the loading script.
> On Monday 04 April 2005 13:37, Dmitry V. Sabanin wrote:
>> I'm having bad times with this odd problem here.
>> I have caching class, that recieves key and instance, caches it and
>> returns result. For some reason when instance of class Foo cached,
>> after it's return it no longer makes following statement true: Foo
>> === instance. instance.class still gives me Foo class, but when i'm
>> trying to do Foo == instance.class I still get false.
>> My question is -- what can happen to a class so it would not longer
>> be able to recognize itself?
>> I'm not doing anything fancy within cache, just wrapping instance
>> in CacheInstance that returns it when asked.
>>
>> Any help appreciated!
Works for me
>> class Foo;end
=> nil
>> f=Foo.new
=> #<Foo:0x1018f090>
>> f2=Marshal.load(Marshal.dump(f))
=> #<Foo:0x10180e88>
>> Foo===f
=> true
>> Foo===f2
=> true
>> Foo.eql? f.class
=> true
>> Foo.eql? f2.class
=> true
Regards
robert