Forum: Ruby Oops, my fault...

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
rosco (Guest)
on 2005-11-28 19:19
(Received via mailing list)
Ahem, well, forget the third question. I'm blaming Eclipse's CVS
- I thought the copy seemed a bit small. Hope I didn't waste anyone's
with that...

What I came up with for this (a better example):

     def blah_blah
       @sh =
       class << @sh
         require 'code_that_adds_new_Object_methods'

         def new_obj


[ The new methods get applied to @sh only ].

(Quoting me):
> I don't know, for example, what happens with objects instantiated in
> that 'scope' (or is this about namespaces?)if they get passed back to
> the main program? I'd guess the methods are retained, because that's
> what happens with the shobject, right? (I can call the file ops from
> IRB), but I've fallen into that trap before  If that's so, then what
> happensin case of a conflict?  How does it work, and are there (m)any
> gotchas to watch for?

Is that it doesn't work at all, apart from with Rake (like the previous
example). So I guess it must be something about the way require is used
Rake? I'd have to look into it a bit more I guess...
This topic is locked and can not be replied to.