I have an array in Ruby which looks like this:
@arr = [ [2.1, pass],
[2.1, fail],
[2.1, pass],
[2.1, unknown],
[2.1, pass],
[3.0, pass],
[3.0, unknown],
[3.1, pass],
[3.1, fail] ]
I want to apply some kind of hashing or computation on it such that my output should be an array like:
@result = [ [2.1, 3, 1, 1],
[3.0, 1, 0, 1],
[3.1, 1, 1, 0] ]
The output array displays results in this format {version, no.of pass, no.of fail, no.of unknown}
If I translate your expression a bit…
Then the problem can be solved with…