8.3. Numerical objects

In Ruby, numbers are objects. You can send messages to them, just as you can to any object:

As you’ll see if you run this code, floating-point numbers know how to round themselves (up or down). Numbers in general know whether they’re zero. And integers can convert themselves to the character that corresponds to their ASCII value .

Numbers are objects; therefore, they have classes—a whole family tree of them.

8.3.1. Numerical ...

Get The Well-Grounded Rubyist, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.