APIdock / Ruby
/
Browse About
method

instance_of?

v2_1_10 - Show latest stable - Class: Object
instance_of?(p1)
public

Returns true if obj is an instance of the given class. See also Object#kind_of?.

class A;     end
class B < A; end
class C < B; end

b = B.new
b.instance_of? A   #=> false
b.instance_of? B   #=> true
b.instance_of? C   #=> false
VALUE
rb_obj_is_instance_of(VALUE obj, VALUE c)
{
    c = class_or_module_required(c);
    if (rb_obj_class(obj) == c) return Qtrue;
    return Qfalse;
}

Related methods

  • Instance methods
  • !~
  • <=>
  • ===
  • =~
  • CSV
  • DelegateClass
  • Digest
  • __getobj__
  • __setobj__
  • chmod
  • class
  • clone
  • cp
  • dclone
  • default_src_encoding
  • define_singleton_method
  • display
  • dup
  • enum_for
  • eql?
  • extend
  • freeze
  • frozen?
  • help
  • httpd
  • initialize_clone
  • initialize_copy
  • initialize_dup
  • inspect
  • install
  • instance_of?
  • instance_variable_defined?
  • instance_variable_get
  • instance_variable_set
  • instance_variables
  • is_a?
  • kind_of?
  • ln
  • method
  • methods
  • mkdir
  • mkmf
  • mv
  • nil?
  • object_id
  • pretty_print
  • pretty_print_cycle
  • private_methods
  • protected_methods
  • psych_to_yaml
  • public_method
  • public_methods
  • public_send
  • remove_instance_variable
  • respond_to?
  • respond_to_missing?
  • rm
  • rmdir
  • send
  • setup
  • singleton_class
  • singleton_method
  • singleton_methods
  • stub
  • sysread
  • taint
  • tainted?
  • tap
  • timeout
  • to_enum
  • to_s
  • to_yaml
  • to_yaml_properties
  • touch
  • trust
  • untaint
  • untrust
  • untrusted?
  • wait_writable
  • xmp
  • Class methods
  • yaml_tag
  • Protected methods
  • protectedhash
APIdock API Documentation Browser

© 2026 APIdock