On Thu, Nov 20, 2008 at 11:45 AM, MarsHall <m@...> wrote:
> For those of us not in attendance to the meeting:
> Is this useful, or purely experimental Ruby?
We were talking about ghost (aka singleton, meta-, eigen- classes)
and I was wondering if I could put a meta class on a meta class.
And, if I did, would a #dup do a deep copy.
Never seen it used before, but I'm sure some rails'er could find a use
for it. ;)
Jim
>
> *Mars
>
> On Nov 19, 2008, at 22:46, Jim Freeze wrote:
>
>> For those that attended the meeting, here is my code where
>> I introduce a singleton class in a singleton class.
>>
>> class C
>>
>> class << self
>> class << self
>> def foo
>> "foo"
>> end
>> end
>>
>> def fred
>> "fred"
>> end
>>
>> def single
>> class << self
>> self
>> end
>> end
>> end
>> end
>>
>> p C.fred
>> p C.single.foo
>>
>> b = C.clone
>> p b.fred
>> p b.single.foo # undefined method foo
>>
>>
>>
>> --
>> Jim Freeze
>
> ( <> .. <> )
>
>
--
Jim Freeze