From: Josh Cheek Date: 2010-04-12T08:25:20+09:00 Subject: Re: Method call within a class --000e0cd11768743b8a0483fe57c2 Content-Type: text/plain; charset=ISO-8859-1 On Sun, Apr 11, 2010 at 2:15 PM, Li Chen wrote: > Hi Andrea, > > Thank you very much. So the receiver can be omitted when the method is > called within a class, right? > > Li > -- > Posted via http://www.ruby-forum.com/. > > Except on assignments, because it looks like you are creating a local variable. Example: class Foo attr_accessor :bar def bad_assign bar = 'baz' defined? bar end def good_assign self.bar = 'baz' defined? bar end end foo = Foo.new foo.bad_assign # => "local-variable" foo.bar # => nil foo.good_assign # => "method" foo.bar # => "baz" --000e0cd11768743b8a0483fe57c2--