Find out the singleton_methods : singleton_methods « Reflection « Ruby






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

 








Related examples in the same category