# Oops, my fault

**URL:** <https://www.ruby-forum.com/t/oops-my-fault/76660>\
**Category:** Ruby\
**Created:** [November 28, 2005, 6:19pm UTC](https://www.ruby-forum.com/t/oops-my-fault/76660 "2005-11-28T18:19:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rosco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/50afbb/32.png) [@rosco](https://www.ruby-forum.com/u/rosco)\
**Post date:** [November 28, 2005, 6:19pm UTC](https://www.ruby-forum.com/t/oops-my-fault/76660/1 "2005-11-28T18:19:31Z")

</div>

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…
