J
Joel VanderWerf
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 `<main>': private method `x=' called for
#<C:0x0000000091c670> (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 `<main>': private method `x=' called for
#<C:0x000000012e5670> (NoMethodError)
Does anyone understand this warning? Is 'private' (without an argument)
deprecated?
$ 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 `<main>': private method `x=' called for
#<C:0x0000000091c670> (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 `<main>': private method `x=' called for
#<C:0x000000012e5670> (NoMethodError)
Does anyone understand this warning? Is 'private' (without an argument)
deprecated?