lib/core/facets/enumerable/inject.rb in facets-2.4.5 vs lib/core/facets/enumerable/inject.rb in facets-2.5.0
- old
+ new
@@ -1,19 +1,18 @@
module Enumerable
- # A small variation of #Inject that save one from having to
+ # A small variation of #Inject that save one from having to
# return the aggregating or memo argument.
#
# Say you want to count letters.
#
# some_text.inject!(Hash.new(0)) {|h,l| h[l] += 1}
#
# vs
#
# some_text.inject(Hash.new(0)) {|h,l| h[l] +=1; h}
#
- # CREDIT: David Black
- # CREDIT: Louis J Scoras
+ # CREDIT: David Black, Louis J Scoras
def inject!(s)
k = s
each { |i| yield(k, i) }
k