Sha256: 4b2319fd243bab8cf68303198581f14f8f590b748d8c475a7223a1e681413bbd

Contents?: true

Size: 352 Bytes

Versions: 9

Compression:

Stored size: 352 Bytes

Contents

class Hash

  # Creates a new hash from two separate arrays, a +keys+ array and
  # a +values+ array.
  #
  #   Hash.zip(["a","b","c"], [1,2,3])
  #   # => { "a"=>1, "b"=>2, "c"=>3 }
  #
  # CREDIT: Trans, Ara T. Howard

  def self.zip(keys,values) # or some better name
    h = {}
    keys.size.times{ |i| h[ keys[i] ] = values[i] }
    h
  end

end

Version data entries

9 entries across 8 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/hash/zip.rb
facets-3.1.0 lib/core/facets/hash/zip.rb
facets-3.0.0 lib/core/facets/hash/zip.rb
facets-2.9.3 lib/core/facets/hash/zip.rb
facets-2.9.2 src/core/facets/hash/zip.rb
facets-2.9.2 lib/core/facets/hash/zip.rb
facets-2.9.1 lib/core/facets/hash/zip.rb
facets-2.9.0 lib/core/facets/hash/zip.rb
facets-2.9.0.pre.2 lib/core/facets/hash/zip.rb