Home
Ruby
ActiveRecord
Array
CGI
Class
Collections
Database
Date
Design Patterns
Development
File Directory
GUI
Hash
Language Basics
Method
Network
Number
Rails
Range
Reflection
Statement
String
Threads
Time
Tk
Unit Test
Windows Platform
XML
Menu
instance_of « Reflection « Ruby
Ruby
Reflection
instance_of
1.
if an object is an instance of a given class with the instance_of? method from Object
2.
Use instance_of? for robustness.
3.
Unlike instance_of?, is_of? or kind_of? also work if the argument is a superclass or module.
4.
Is it a string class instance
5.
Is it a number
6.
Use === to check the class type