Class Hash |
|
Methods |
Public Class methods |
zip(a) |
Given an array of pairs (e.g., [ [a,b], [c,d,e] ]), returns a a hash s.t. the keys are the first elements of the arrays, and the values are the last elements of the array. Given the example above, the resulting hash would be { a=>b, c=>[d,e] }.
# File util/aryzip.rb, line 82 def zip(a) h = {} a.each { |aa| h[aa.car] = aa.cdr } return h end