Search⌘ K
AI Features

Everything Is An Object in Ruby (Proof)

Learn how to use Ruby’s is_a? method to verify object types, confirming that all data types such as integers and strings are objects. This lesson deepens your grasp of Ruby's core principle that everything is an object, forming a basis for further study.

We'll cover the following...

The is_a? method

We know that 123.class returns an integer, and blabla.class returns a string. However, every object also has is_a? method, which returns either true or false, depending on the parameter we’re passing to that method:

$ irb
> 123.is_a?(Integer)
=> true
...