Sean O'Halpin schrieb: > On 7/26/06, Ashley Moran <work / ashleymoran.me.uk> wrote: >> < SNIP bit that shows me up as clueless :) > > > Don't take it so hard - we're all still learning :) And some actually enjoy it :) >> Seems I misunderstood the scope of "self". I assumed that since a Food >> instance was calling a method in another object (the application >> instance of Object) that self would be the global "main" object. IE: >> >> irb(main):003:0> class Foo >> irb(main):004:1> def test >> irb(main):005:2> global_test >> irb(main):006:2> end >> irb(main):007:1> end >> => nil >> irb(main):008:0> def global_test >> irb(main):009:1> puts self.class >> irb(main):010:1> puts self.inspect >> irb(main):011:1> end >> => nil >> irb(main):012:0> Foo.new.test Ashley, in addition to Sean's answer, remember that the methods you define at the toplevel, outside of any class, aren't singleton methods of the "main" object. Instead, they are private methods of class Object. Since every class is a subclass of Object, they inherit these "toplevel" methods. In your method Foo#test, you're actually calling self.global_test so you're not calling a method of a different object. The following is based on your code above: f = Foo.new f.test # => #<Foo:0x2b84b80> f.global_test rescue puts $! # => private method `global_test' called for #<Foo:0x2b84b80> You see from the error message, that global_test is a private method, and I'm calling it for my Foo instance. Now I'm going to make the method public: class Object public :global_test end f.global_test # => #<Foo:0x2b84b80> Regards, Pit