Objects in Ruby have some methods for rendering into another type, such as:
-
to_s
: convert to string -
to_a
: convert to array -
to_i
: convert to integer -
to_f
: convert to float
But there is no standard method for converting an object to boolean, nor in the Object
class. How to do this conversion?