class A
class << A
def aaa
end
protected
def bbb
end
private
def ccc
end
end
end
p A.singleton_methods # => [“aaa”, “bbb”]
private method is not a singleton method… Why?
Anyway ‘ccc’ is defined in a singleton class of A ?
###############
Help Me^^
###############
On Thu, Jan 8, 2009 at 8:29 AM, Kyung won Cheon [email protected]
wrote:
def ccc
Help Me^^
###############
Posted via http://www.ruby-forum.com/.
I have never noticed that before, I certainly do not like that.
If you need that information you could do the following
class Object
def my_sing_methods # this does not sing
singleton_methods + begin
class << self; self end.private_instance_methods( false )
rescue
[ ]
end
end
end
This however gives you three more methods, namely :inherited,
:initialize, :initialize_copy.
You can of course get rid of them, but what if they are overloaded?
Unfortunately I can not
think of any simple code to cover that.
Cheers
Robert