lib/core/facets/enumerable/collect.rb in facets-2.4.5 vs lib/core/facets/enumerable/collect.rb in facets-2.5.0
- old
+ new
@@ -3,11 +3,11 @@
# Same as #collect but with an iteration counter.
#
# a = [1,2,3].collect_with_index { |e,i| e*i }
# a #=> [0,2,6]
#
- # CREDIT: Gavin Sinclair
+ # CREDIT: Gavin Sinclair
def collect_with_index
r = []
each_index do |i|
r << yield(self[i], i)
@@ -30,10 +30,10 @@
#
# [2,3]
#
# NOTE: Perhaps nicer to have as added functionality for #compact.
#
- # CREDIT: Trans
+ # CREDIT: Trans
def compact_map(trash=nil, &block)
y = []
if block_given?
each do |*a|