Sha256: 59f0ee348f48f3d870c56ddbc7c27436641f52912cac895b6115e49dbf1051f6

Contents?: true

Size: 347 Bytes

Versions: 11

Compression:

Stored size: 347 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, 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

11 entries across 11 versions & 1 rubygems

Version Path
facets-2.9.0.pre.1 lib/core/facets/hash/zipnew.rb
facets-2.8.4 lib/core/facets/hash/zipnew.rb
facets-2.8.3 lib/core/facets/hash/zipnew.rb
facets-2.8.2 lib/core/facets/hash/zipnew.rb
facets-2.8.1 lib/core/facets/hash/zipnew.rb
facets-2.8.0 lib/core/facets/hash/zipnew.rb
facets-2.7.0 lib/core/facets/hash/zipnew.rb
facets-2.6.0 lib/core/facets/hash/zipnew.rb
facets-2.5.1 lib/core/facets/hash/zipnew.rb
facets-2.5.0 lib/core/facets/hash/zipnew.rb
facets-2.5.2 lib/core/facets/hash/zipnew.rb