So I am working on an application where I have an array where I need to the sum of the values of members of the array, if they fulfill certain conditions. It looks like this:
if !A and !B
array.each do {|a| if (some condition) sum += a }
if A and !B
array.each do {|a| if (some other [...]
