An alternative is to use Array # map :
A = [["a1","a2","a3"],["b1","b2","b3"],["c1","c2","c3"]]
=> [["a1", "a2", "a3"], ["b1", "b2", "b3"], ["c1", "c2", "c3"]]
>> col = 0
=> 0
>> A.map{|a| a[col]}
=> ["a1", "b1", "c1"]
If necessary, can be minimized to a method.
source
share