1
Ruby objects have some methods for representation in another type, such as:
to_s
: convert to stringto_a
: convert to arrayto_i
: convert to wholeto_f
: convert to float
But there is no standard method to convert an object to boolean, nor in the class Object
. How to make this conversion?
It would not be more appropriate to use
to_b "olá"
instead of"olá".to_b
?– Luiz Felipe
@Luizfelipe edited, thank you ;)
– vinibrsl