From: Li Chen Date: 2010-04-12T09:34:47+09:00 Subject: Re: Method call within a class Josh Cheek wrote: > On Sun, Apr 11, 2010 at 2:15 PM, Li Chen wrote: > >> Hi Andrea, > 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" Thank you so much. Where can I find more info about this usage? Li -- Posted via http://www.ruby-forum.com/.