Ruby/Reflection/singleton methods
Материал из Wiki.crossplatform.ru
Версия от 17:57, 13 сентября 2010; ViGOur (Обсуждение | вклад)
Find out the singleton_methods
p Object.singleton_methods # => [] p Fixnum.singleton_methods # => ["induced_from"] class MyClass def MyClass.my_singleton_method end def my_instance_method end end MyClass.singleton_methods # => ["my_singleton_method"] "".methods == String.instance_methods # => true