| Message: 93144 |
 |
BY: Dan Rathbun (danzoid61) DATE: 2010-03-26 03:44 SUBJECT: RE: Getting Namespace & Nesting Info Internally OK Dan... the note in the file didn't explain what you were after. The posting at ruby-talk is more clear. (And thanks for that link, I was wondering where the ruby forums were.)
So you wish that an instance object would be able to know who it's "author" is ?? (I purposely avoid using familial terms, because it they are usually confused with the class-object hierarchy. I also avoid using the term "owner" as it's really Ruby that creates, owns and manages all objects. A context, such as a class or module, can only cause an object instance to be created, and have the first of what may be many references assigned to point at that object. And so I use the term "author.")
I see two scenarios: (Easy and Difficult.)
(1) If the instance objects are created by YOU, inside contexts (Class or Module,) that are YOUR definitions, then the solution is easy.
(2) If it's everyone else's instance objects, created by Classes or Modules that YOU do NOT control, then a solution will be difficult, and perhaps immpossible without a change within the Ruby core.
Which scenario is it that your after? | |