What is the easiest way to convert a ruby array to an array of consecutive pairs of its elements?
I mean:
x = [:a, :b, :c, :d]
Expected result:
y #=> [[:a, :b], [:c, :d]]
What is the easiest way to convert a ruby array to an array of consecutive pairs of its elements?
I mean:
x = [:a, :b, :c, :d]
Expected result:
y #=> [[:a, :b], [:c, :d]]