use Object's is_a? or kind_of? methods (they are synonyms) : kind_of « Reflection « Ruby






use Object's is_a? or kind_of? methods (they are synonyms)


myString = "asdf"

puts myString.is_a? String # => true
puts myString.kind_of? String # => true

 








Related examples in the same category

1.determine our object's class and its unique objectID and test its relationship to other classes.
2.Return value based on parameter type