Sha256: 762d6d7c3627c0c7971e121ea3e7460ae29fa8cc24a384ddd681ebcf648b9b91
Contents?: true
Size: 261 Bytes
Versions: 3
Compression:
Stored size: 261 Bytes
Contents
module Enumerable # Produces a hash from an Array with index for keys. # # require 'facet/array/to_hash' # # a1 = [ :a, :b ] # a1.to_hash #=> { 0=>:a, 1=>:b } # def to_hash h = {} each_with_index{|e,i| h[i] = e } h end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-0.7.0 | lib/facet/enumerable/to_hash.rb |
facets-0.7.1 | lib/facet/enumerable/to_hash.rb |
facets-0.7.2 | lib/facet/enumerable/to_hash.rb |