Check respond_to? for new added instance method : respond_to « Reflection « Ruby






Check respond_to? for new added instance method

class MyClass
  def MyClass.my_singleton_method
 end

  def my_instance_method
  end
end

p MyClass.respond_to? :my_instance_method       # => false

 








Related examples in the same category

1.The respond_to? method from Object checks to see if a given object responds to a given method.
2.The method respond_to? tests to see whether an instance of Address has access to :given_name, inherited from the Name class.
3.Testing Whether an Object Is String-like
4.Check respond_to? for new added singleton method