From: Pedro Silva Date: 2008-09-02T18:38:36+09:00 Subject: Re: Self and Current Class Hi David, >> def self.some_inside_class_method >> puts "Inside class method - #{self}" >> end > That's not a class method. self is an instance of SomeClass; you're > defining a singleton method on that instance. If forgot to change the text, I mean't singleton method. Thanks for pointing that out. >> def some_inside_instance_method >> # self is an instance, current class is SomeClass >> puts "Inside instance method - #{self}" >> end > > I'm not sure what you mean by "inside" in the method name. It's just > an instance method. This case was to test the def keyword inside an instance method, because at class level self is the class, inside instance method self is the instance. > It's a keyword, rather than a method, but I think it is the only thing > that cares about the notion of "current class", at least as I > understand that notion. (I admit it's not one that I've paid much > attention to, by that name, though of course I like to know what 'def' > will do at any given time.) I really wanted to know if current class is used anywhere else by any other keyword/method to try to fully understand these two concepts. Pedro. -- Posted via http://www.ruby-forum.com/.