Is there a generally preferred way to truncate an array? I've used
these two, but is there a better way?
SOME_ARRAY = [1, 2, 3]
1. SOME_ARRAY.each_index{|i| SOME_ARRAY[i].nil}.compact!
2. SOME_ARRAY.slice!(1..0)
=> SOME_ARRAY == []
Is there a generally preferred way to truncate an array? I've used
these two, but is there a better way?
SOME_ARRAY = [1, 2, 3]
1. SOME_ARRAY.each_index{|i| SOME_ARRAY[i].nil}.compact!
2. SOME_ARRAY.slice!(1..0)
=> SOME_ARRAY == []