Performing union of two arrays with custom rules
<p>I have two arrays</p>

<pre><code>b = ["John Roberts", "William Koleva", "Lili Joe", "Victoria Jane", "Allen Thomas"]

a = ["Jon Roberts", "Wil Koleva", "Lilian Joe", "Vic Jane", "Al Thomas"]
</code></pre>

<p>Currently I am using the union operator on these two arrays, like this: <code>a | b</code>. When combined, even though the names in each array are the "same" name (they're just using the shortened version of the name), it will duplicate my names. </p>

<p>My proposed solution to this is simply choose the first occurrence of first initial + last name as the name to perform the union on, however, I don't recall there being any methods in Ruby that can perform such an operation.</p>

<p>So the result of <code>some_method(a | b)</code> will return <code>c</code> which is just:</p>

<pre><code>["John Roberts", "William Koleva", "Lili Joe", "Victoria Jane", "Allen Thomas"]
</code></pre>

<p>I am wondering how I could go about achieving this? </p>