views:

16

answers:

2

For example I do

$fri group_by
---------------------------------------------------- Enumerable#group_by
     enum.group_by {| obj | block }  => a_hash
------------------------------------------------------------------------
     Returns a hash, which keys are evaluated result from the block, 
     and values are arrays of elements in enum corresponding to the key.

        (1..6).group_by {|i| i%3}   #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}

Except I'm pretty sure that group_by is not part of the standard ruby library. How to find out which library is monkey patching Enumerable?

+1  A: 

group_by is part of the ruby core since 1.8.7.

mikej
+1  A: 

use the ri_for gem:

>> require 'ri_for'
>> Enumerable.ri_for :group_by
sig: Enumerable#group_by arity 0
appears to be a c method
Original code signature: sig: Enumerable#group_by arity 0
#parameters signature: group_by( [] )
Searching ri for
sig: Enumerable#group_by arity 0
...
Nothing known about Enumerable
(end ri)
=> "#"

(the fact that it's a c method means it's probably in core)

rogerdpack