Chapter 1. Converting Between Types

The word “type” comes with a lot of baggage and I use it deliberately here. Programmers coming from other languages will likely expect Ruby, like all languages, to implement certain core “types”: integers, floats, strings, characters, etc. However, in Ruby there really isn’t such a thing as a traditional primitive type. Even integers are stored as instances of the Fixnum (or Bignum) class. They are objects just like any other. If you are new to Ruby, you should keep repeating this to yourself as you are coding: “everything is an object, everything is an object, ...”. That’s the rule to swim or sink by in Ruby. Absolutely everything around is an object: an instance of a class.

Also, keep in mind that the rigidness ...

Get Ruby Phrasebook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.