Writing a plugin: Need to get including class's name. Help?

Chris Johnson wrote:


For reference, here is some sample code that exemplifies what I am trying to do: gist:102816 · GitHub

I am trying to dynamically defined a class, whose name is either passed in as a parameter or based on the including class name.

So if I had something like this: class Green; acts_as_duck; end

I would expect the generated class to be called "GreenDuck", and to be defined within the "Green" class.

The problem is that no matter what I do, the dynamically referenced class name is always just "Class".

Any suggestions here?

Thanks. Chris

For the record, I got around this by doing some dynamic eval in the module eval:


Maybe there was a simpler way(?)