What about
abc = [a,b,c].reject(&:empty?).reduce(:&)
The first part, [a,b,c] puts your arrays into an array. The second bit with reject runs empty? for each element and rejects it if the result is true, returning an array of arrays where empty arrays are deleted. In the last part of reduce , the equivalent of your a & b & c is executed, but since we discarded all empty arrays in the previous step, you will not get an empty result.
source share