I have an array of arrays and I would like to remove all the items that have elements which are nil or empty after stripping spaces. Look at this snippet:
x = Array.new
x << ["A","B", " ", "D"]
x << [""," ", nil, ""]
x << ["E","Q", "F", "M"]
I would like to remove the second record because, it contains no real data.
What would be the best way to do this? Should I simply iterate over the array and and write if-else conditions to test?
If using plain Ruby, you can do
If using rails, thanks to the helper methods you can do
The key methods are
rejectandblank?