From: Shugo Maeda Date: 2009-11-16T14:26:23+09:00 Subject: [ruby-core:26761] [Bug #2375] protected singleton methods can be called from other instances Bug #2375: protected singleton methods can be called from other instances http://redmine.ruby-lang.org/issues/show/2375 Author: Shugo Maeda Status: Open, Priority: Low Assigned to: Yukihiro Matsumoto ruby -v: 1.9.2dev It seems that protected singleton methods of an object can be called from other instances of the class of the object. class Foo end FOO = Foo.new class << FOO protected def bar puts "bar" end end class Foo def baz FOO.bar end end FOO.baz Foo.new.baz # CRuby does not raise NoMethodError, but IronRuby does. On IronRuby, Foo.new.baz raies NoMethodError, and I guess it's more reasonable than the behavior of CRuby. I have attached a patch. However, I haven't been able to find any use cases of protected singleton methods. ---------------------------------------- http://redmine.ruby-lang.org