I have an array:
foo = [[51, 05,1.0],[51,979,0.18]]
What I would like to do is take this array and select all nested arrays that have the last value less than 1. So the output from the above would be
result = [[51,979,0.18]]
I have tried:
foo.select { |p| p.last < 1 }
But I get the error:
NoMethodError (undefined method `last'
The array is much larger than just two but I have listed the above as en example. I thought .select would be right, but I can not get it to work.