Ruby/Reflection/singleton methods
Материал из Wiki.crossplatform.ru
(Различия между версиями)
ViGOur (Обсуждение | вклад) м (1 версия: Импорт выборки материалов по Ruby) |
Текущая версия на 17:57, 13 сентября 2010
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