mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08: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
|