IO#puts and arrays

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs