Module: Enumerable

Defined in:
lib/zenweb/extensions.rb

Instance Method Summary collapse

Instance Method Details

#multi_group_byObject



13
14
15
16
17
18
19
20
21
# File 'lib/zenweb/extensions.rb', line 13

def multi_group_by
  r = Hash.new { |h,k| h[k] = [] }
  each do |o|
    Array(yield(o)).each do |k|
      r[k] << o
    end
  end
  r
end