Sha256: d93b51d5971906a7fb2fbd02235dd6a32358a97bc95ebeae4c56e1b6712e4b28

Contents?: true

Size: 263 Bytes

Versions: 1

Compression:

Stored size: 263 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

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.6.3 lib/facet/enumerable/to_hash.rb