From: Chad Perrin Date: 2012-07-07T08:49:37+09:00 Subject: Re: basic queries On Fri, Jul 06, 2012 at 11:30:52PM +0900, John Lee wrote: > Consider the following code: > > class Drawing > def Drawing.give_me_a_circle <------- > Circle.new > end > > class Line > end > > class Circle > def what_am_i > "This is a circle" > end > end > end > --------------------------------------------- > > why must type "def Drawing.give_me_a_circle"? > why can't i type "def give_me_a_cirlce" instead? As already pointed out, "def Drawing.give_me_a_circle" defines a class method, and not an instance method. You can also use "self" instead of "Drawing" there: def self.give_me_a_circle That should have the same effect as this: def Drawing.give_me_a_circle . . . unless I've overlooked something. I'm pretty worn out for a Friday evening. -- Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]