Module: Enumerable

Defined in:
lib/album_credits/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#group_byObject



2
3
4
5
6
7
# File 'lib/album_credits/core_ext.rb', line 2

def group_by
  inject({}) do |grouped, element|
    (grouped[yield(element)] ||= []) << element
    grouped
  end
end