Oops, my fault...

R

Ross Bamford

Ahem, well, forget the third question. I'm blaming Eclipse's CVS handling
- I thought the copy seemed a bit small. Hope I didn't waste anyone's time
with that...

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 ].

(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 in
Rake? I'd have to look into it a bit more I guess...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top