P
Patrick Li
Hi,
Is there any easy to unsplat an item?
ie. 1 becomes [1]
[2,3] remains [2,3] ?
so far i found:
a = *[1]
*b = *a #=> [1]
a = *[1,2]
*b = *a #=> [1,2]
but this doesn't work if a is a hash, because hash overrides the to_a
method
a = *[{"a"=>1}]
*b = *a #=> [["a",1]] when i actually want: [{"a"=>1}]
Thanks for helping
-Patrick
Is there any easy to unsplat an item?
ie. 1 becomes [1]
[2,3] remains [2,3] ?
so far i found:
a = *[1]
*b = *a #=> [1]
a = *[1,2]
*b = *a #=> [1,2]
but this doesn't work if a is a hash, because hash overrides the to_a
method
a = *[{"a"=>1}]
*b = *a #=> [["a",1]] when i actually want: [{"a"=>1}]
Thanks for helping
-Patrick