Nikhil Warade wrote:
> (1..3).to_a will not give any warning and will convert it to [1,2,3]
Object#to_a is being deprecated, so you will get the warning with
classes that don't implement their own. When they do, as is the case
with Range objects, you won't see it.
Since the only "hint" that was given in the initial question was that
Array was definitely a possibility as an input, so I assumed that an
unknown class could be set as x. In his actual problem this is almost
certainly more clearly restricted.
--
Posted via http://www.ruby-forum.com/.