When you enter a script, am I right in thinking that automatically an
overall Module object and a Class object are created, so that all your
methods not within another class or module are part of these objects?
What are the names of these two default objects?
This is only one. At the TOPLEVEL you are in an a special instance of
Object which has some special method which are delegated to the Object
class itself.
You can see this because while say, #include work at the top level,
#define_method does not. Try it and you will get:
undefined method `define_method' for main:Object
I hope that helps.
Taking some leeway with the topic... I've done enough meta-programming
to tell you I so not like the way this works. It can be notoriously
difficult to create a module, heavy in the meta-code, that can be made
to apply to the entire system as it does to an individual class. I
have always maintained that the TOPLEVEL should be a self-extended
module, which would correct this issue and simplify the whole TOPLEVEL
design, but alas my suggestion has continually fallen on deaf ears.
T.