class Array # [[1,2]] => {1=>2} def to_hash hash = {} each {|k,v| hash[k]=v} hash end end