Grabbing an included module's proxy class

You can grab a singleton class with this well-known trick:

x = 'foo’
singletonClass = class << x; self; end

But is it possible to grab an included module’s proxy class? So if I
include module Mod into class String, like:

class String
include Mod
end

can I get the String:Mod proxy class?

Just curious,

Chris

Hi –

···

On Tue, 11 Feb 2003, Chris Pine wrote:

You can grab a singleton class with this well-known trick:

x = ‘foo’
singletonClass = class << x; self; end

But is it possible to grab an included module’s proxy class? So if I
include module Mod into class String, like:

class String
include Mod
end

can I get the String:Mod proxy class?

class << Mod; self; end

David


David Alan Black
home: dblack@candle.superlink.net
work: blackdav@shu.edu
Web: http://pirate.shu.edu/~blackdav

class << Mod; self; end

···

----- Original Message -----
From: dblack@candle.superlink.net


That just gives me a singleton class for Mod. Is that the same thing?

Maybe I am just confused, but I thought that when you include a module into
a class, a new, hidden proxy class was created as the new superclass of the
original class. (I’m getting this from the pickaxe, page 247, Figure 19.4.)

So I was wondering if it’s possible to get that class. Is that the same
thing? I was under the impression that there could be many different proxy
classes for a single module: one for each class it was included into (or
object it extended, which is the same as including it into the object’s
singleton class, I think).

Chris