Ruby: Object.to_a replacement

后端 未结 7 1370
后悔当初
后悔当初 2020-12-25 12:03

I need to convert a passed in argument (single object or collection) to an Array. I don\'t know what the argument is. If it is an Array already, I want to leave it, otherwis

相关标签:
7条回答
  • 2020-12-25 12:48

    What about Array.new(1, arg)?

    0 讨论(0)
提交回复
热议问题