module Digiproc::CoreExtensions::ArrayExtension::Sum
Public Instance Methods
plus(arr)
click to toggle source
Add two arrays element by element. They must be the same size
myArray.plus(anotherArr) # => Array (same size as the input)
# File lib/extensions/core_extensions.rb, line 22 def plus(arr) raise ArgumentError.new("sizes must be equal") if self.size != arr.size output = [] self.each_with_index do |o,i| output << o + arr[i] end output end