> 'self' is available.  Remember that in Ruby, global methods aren't
> global methods. They are methods in Object. You can access them not
> because they're global, but because Object is the parent of all objects
> in the system, and therefore you're simply invoking a method in your
> superclass. As such, the method is being invoked in your context. That
> means you can do slightly devilish things :)

That works OK if I do it by having a method in the class that then calls
the global function to define the class's method.  However, that means I
have to make sure I call that method for each object of that class.

However, if I just call the global function as part of the class
definition, which I would expect  to define the method such that it's
available in every object of that class.  It doesn't seem to work.

When I print out what "self" is, it is the class name when I call the
global from inside the class and it's a specific instance of the class
when I call it from a method of the class.

That makes sense, so I'm confused as to why it doesn't work.

Obviously, it's defining a method in some context, but not the right one.
Is there any way I could write something that will tell me what method
it's actually creating?  That might help me debug what's going on.