I\'ll use python as an example of what I\'m looking for (you can think of it as pseudocode if you don\'t know Python):
>>> a = 1
>>> type(a)
&l
Oftentimes in Ruby, you don't actually care what the object's class is, per se, you just care that it responds to a certain method. This is known as Duck Typing and you'll see it in all sorts of Ruby codebases.
So in many (if not most) cases, its best to use Duck Typing using #respond_to?(method):
object.respond_to?(:to_i)