mirror of
https://github.com/mistydemeo/tigerbrew.git
synced 2026-11-27 03:19:46 -05:00
8 lines
160 B
Ruby
8 lines
160 B
Ruby
module Enumerable
|
|
def group_by
|
|
inject({}) do |h, e|
|
|
h.fetch(yield(e)) { |k| h[k] = [] } << e; h
|
|
end
|
|
end unless method_defined?(:group_by)
|
|
end
|