Mega Code Archive

 
Categories / Ruby / Reflection
 

Is it a number

x = 1                    # This is the value we're working with x.instance_of? Fixnum    # true: is an instance of Fixnum x.instance_of? Numeric   # false: instance_of? doesn't check inheritance