From: matt@... (matt neuburg) Date: 2009-06-03T12:00:09+09:00 Subject: Re: Do I need self in this method definition Li Chen wrote: > and it prints out the expected results. I wonder if I have to use > self#method in my implement. > > class Hash > def self.my_each(hash1={}, hash2={}) > end > end > > Hash.my_each(hash1, hash2) You do if you really want a class method - that is, if you want to be able to call this thing by saying Hash.my_each(hash1, hash2). The alternative is to make an instance method. Then you could call it by saying hash1.my_each(hash2). In that case, you would not use "self" in the def. m. -- matt neuburg, phd = matt@tidbits.com, http://www.tidbits.com/matt/ Leopard - http://www.takecontrolbooks.com/leopard-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com