From: Rein Henrichs Date: 2010-06-06T07:45:05+09:00 Subject: Re: 1.9 warning for 'private' and possible bug This behavior seems consistent with, for instance: class PrivateAccessor private attr_accessor :foo end PrivateAccessor.new.foo # => NoMethodError: private method `foo' called for # On 2010-06-05 15:25:59 -0700, Joel VanderWerf said: > Consider this error: > > $ cat t.rb > module M > private > def attr_accessor(*args); super; end > end > > class C > extend M > attr_accessor :x > end > > C.new.x = 1 > > $ ruby19 t.rb > t.rb:11:in `
': private method `x=' called for > # (NoMethodError) > > > That looks very suspect, so I was about to file a bug report. But then I > noticed that there is a warning reported with the -v switch: > > $ ruby19 -v t.rb > ruby 1.9.2dev (2010-05-31) [x86_64-linux] > t.rb:3: warning: private attribute? > t.rb:11:in `
': private method `x=' called for > # (NoMethodError) > > > Does anyone understand this warning? Is 'private' (without an argument) > deprecated? -- Rein Henrichs http://puppetlabs.com http://reinh.com