IO#puts and arrays


#1

Exactly how does IO#puts determine if an argument is an array? That is,
how do I construct an object that is treated like an Array object by
IO#puts, preferably without inheriting from Array – I had hoped a
#to_arr method would suffice, but alas, it did not.

Daniel


#2

Daniel S. wrote:

Exactly how does IO#puts determine if an argument is an array? That is,
how do I construct an object that is treated like an Array object by
IO#puts, preferably without inheriting from Array – I had hoped a
#to_arr method would suffice, but alas, it did not.

Oooops, it was #to_ary, and it’s working like a charm :slight_smile:

Sorry to have bothered you!

Daniel