I am currently trying to convert this ruby array:
[5, 7, 8, 1]
in it:
[[5], [7], [8], [1]]
What is the best way?
I am currently doing it like this:
[5, 7, 8, 1].select { |element| element }.collect { |element| element.to_a }
But I get the following errors:
warning: by default, `to_a 'will be deprecated
What am I doing wrong? Could you advise how to do it right?
Thanks in advance and best regards!
jlstr source share