Is there a more elegant way of accomplishing the following in Ruby?
array_1 = [1,2,3]
array_2 = [3,4,5]
(array_1 - array_2).each do |num|
some_method_z(num)
end
(array_2 - array_1).each do |num|
some_method_x(num)
end
For example-- would love to be able to do something like:
difference_1, difference_2 = ruby_method(array_1, array_2)
which would be the equivalent to:
difference_1 = array_1 - array_2
difference_2 = array_2 - array_1