From: Joel VanderWerf Date: 2010-06-06T09:02:17+09:00 Subject: Re: 1.9 warning for 'private' and possible bug Rein Henrichs wrote: > On 2010-06-05 15:55:20 -0700, Joel VanderWerf said: >> >> No. The original code is controlling access to the method >> Module#attr_accessor. Your code is controlling access to >> PrivateAccessor#foo. > > Not exactly. Methods created by attr_accessor will have its visibility. > Your code makes attr_accessor private, which is why accessors created > with it are also private. You can also demonstrate by writing your own > attr_accessor from scratch. Did you try that? The following code runs the same in 1.8 and 1.9: class C class << self def my_attr_accessor(name) define_method name do puts "foo" end end private :my_attr_accessor end my_attr_accessor :bar end C.new.bar # => foo Anyway, attr_accessor is already a private module method in ruby, but the instance methods it creates are not, by default.