Forum: Ruby IO#puts and arrays

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5da4c52f43677f395aff5bde775593c2?d=identicon&s=25 Daniel Schierbeck (dasch)
on 2006-05-08 23:30
(Received via mailing list)
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
5da4c52f43677f395aff5bde775593c2?d=identicon&s=25 Daniel Schierbeck (dasch)
on 2006-05-08 23:33
(Received via mailing list)
Daniel Schierbeck 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 :)

Sorry to have bothered you!


Daniel
This topic is locked and can not be replied to.