Module: Enumerable
- Defined in:
- lib/ruby_patch/core_ext/enumerable.rb
Instance Method Summary collapse
Instance Method Details
#classify(&block) ⇒ Object
4 5 6 7 8 |
# File 'lib/ruby_patch/core_ext/enumerable.rb', line 4 def classify(&block) h = Hash.new{[]} self.each{|o| h[yield(o)] += [o]} h end |