Sha256: f87d126d46efaf76aa1a166552233122f7286eaa60a4d58034c13b00b495f4ba
Contents?: true
Size: 278 Bytes
Versions: 6
Compression:
Stored size: 278 Bytes
Contents
# for versions of ruby < 1.8.7 module Enumerable def index_by inject({}) do |accum, elem| accum[yield(elem)] = elem accum end end def group_by #:yield: #h = k = e = nil r = Hash.new each{ |e| (r[yield(e)] ||= []) << e } r end end
Version data entries
6 entries across 6 versions & 1 rubygems