[MacRuby-devel] KVC: different behaviour with set and =

Vincent Isambart vincent.isambart at gmail.com
Mon May 17 01:20:52 PDT 2010


> class Controller < NSWindowController
>  attr_accessor :test
>  def works
>    setTest true
>  end
>  def doesnotwork
>    test = true
>  end
> end

"test = true" should be "self.test = true"
"test = true" just creates a local variable named test.
It's a very common mistake in Ruby.


More information about the MacRuby-devel mailing list