lib/core/facets/enumerable/collect.rb in facets-2.0.5 vs lib/core/facets/enumerable/collect.rb in facets-2.1.0

- old
+ new

@@ -111,10 +111,16 @@ inject(s) do |k, i| yield(k, i); k end end + # TODO Faster implementation? Verify equivalency. + #def injecting(res, &block) + # ([res]*length).zip(to_a).each(&block) + # res + #end + # The #group_by method is best explained by example. # # (1..5).partition_by { |n| n % 3 } # #=> { 0 => [3], 1 => [1, 4], 2 => [2,5] } # @@ -148,11 +154,10 @@ # [ ['a'], ['is'], ['this', 'test'] ] # # CREDIT Erik Veenstra def cluster_by(&b) - #group_by(&b).values - group_by(&b).sort.transpose.pop + group_by(&b).sort.transpose.pop || [] # group_by(&b).values ? end # Split on matching pattern. # # ['a1','b1','a2','b2'].divide(/^a/)