Sha256: 3eb3f27ffe55283289091530f46100538347cdc98da29d4ea2caf956884adb6a
Contents?: true
Size: 360 Bytes
Versions: 2
Compression:
Stored size: 360 Bytes
Contents
class Hash # Creates a new hash from two arrays --a keys array and # a values array. # # Hash.zipnew(["a","b","c"], [1,2,3]) # #=> { "a"=>1, "b"=>2, "c"=>3 } # # CREDIT: Trans # CREDIT: Ara.T.Howard def self.zipnew(keys,values) # or some better name h = {} keys.size.times{ |i| h[ keys[i] ] = values[i] } h end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facets-2.2.1 | lib/core/facets/hash/zipnew.rb |
facets-2.3.0 | lib/core/facets/hash/zipnew.rb |