2015-02-20 00:35:01 -05:00
|
|
|
keys = ['hal',666,[1,2,3]]
|
|
|
|
|
vals = ['ibm','devil',123]
|
2013-04-10 21:29:02 -07:00
|
|
|
|
2015-02-20 00:35:01 -05:00
|
|
|
hash = Hash[keys.zip(vals)]
|
2013-04-10 21:29:02 -07:00
|
|
|
|
|
|
|
|
p hash # => {"hal"=>"ibm", 666=>"devil", [1, 2, 3]=>123}
|
|
|
|
|
|
|
|
|
|
#retrieve the value linked to the key [1,2,3]
|
|
|
|
|
puts hash[ [1,2,3] ] # => 123
|