Mega Code Archive

 
Categories / Ruby / Reflection
 

Determine our objects class and its unique objectID and test its relationship to other classes

num =1  num.id # 3  num.class # Fixnum  num.kind_of? Fixnum # true  num.kind_of? Numeric # true  num.instance_of? Fixnum # true  num.instance_of? Numeric # false