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
What I came up with for this (a better example):
def blah_blah @sh = Object.new class << @sh require 'code_that_adds_new_Object_methods' def new_obj Object.new end end @sh end
[ The new methods get applied to @sh only ].
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…