Module: Enumerable

Defined in:
lib/ruby_patch/enumerable.rb

Instance Method Summary collapse

Instance Method Details

#classify(&block) ⇒ Object



2
3
4
5
6
# File 'lib/ruby_patch/enumerable.rb', line 2

def classify(&block)
  h = Hash.new{[]}
  self.each{|o| h[yield(o)] += [o]}
  h
end