lib/guerrilla_patch/kernel.rb in guerrilla_patch-2.3.0 vs lib/guerrilla_patch/kernel.rb in guerrilla_patch-2.3.1
- old
+ new
@@ -38,19 +38,13 @@
def when(item, &block)
return unless item
@result << Kernel.when_present(item, &block).to_s
end
end
+end
-
#add sum to array, with or without name
class Array
- def sum
- self.reduce(0, :+)
- end
-
- def sum(name)
+ def sum(name = nil)
self.map(&name).reduce(0, :+)
end
end
-
-end