array = [[1555,100],[nil,95],[1774,nil],[1889,255]]
What would be the best way to remove the 2nd and 3rd elements from array since they have NULL fields?
Expected output :
array = [[1555,100],[1889,255]]
Use .compact to remove nil elements from array of arrays
array.map(&:compact)
# array = [[1555,100], [95], [1774], [1889, 255]]
Edit
Use .reject! to remove sub arrays containing nil elements.
array.reject! { |e| e.any? nil }
# array = [[1555,100], [1889,255]]
NULL
nil, notNULL. Ruby does not have aNULL.