Module: Enumerable

Included in:
SimpleMapper::Associations::Association::Set
Defined in:
lib/simple_mapper/support/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#group_byObject



92
93
94
95
96
97
# File 'lib/simple_mapper/support/core_ext.rb', line 92

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