From: Pit Capitain Date: 2005-07-19T19:31:05+09:00 Subject: Re: Querying private singleton methods Pit Capitain capitain.de> writes: > ... So there's no way to ask about private singleton methods. Just a followup: I found a hack to get at private singleton methods: class Object def private_singleton_methods( all = true ) self_priv = private_methods( all ) class_priv = self.class.private_instance_methods( all ) ( self_priv - class_priv ) | ( self_priv & class_priv ).select { |method| definer = self.class.ancestors.find { |klass| klass.private_instance_methods( false ).include?( method ) } definer.send( :public, method ) begin private_methods( all ).include?( method ) ensure definer.send( :private, method ) end } end def protected_singleton_methods( all = true ) protected_methods( all ) & singleton_methods( all ) end def public_singleton_methods( all = true ) public_methods( all ) & singleton_methods( all ) end end Still I think there should be a better way. Comments? Regards, Pit