title: Best practice for writing complex, three-part, interchangeable "uniq" ruby block
body: <p>I have an array of hashes:</p>
  <pre><code>array = [
  {foo: 1, bar1: 2 bar2: 3, bar3: 4},
  {foo: 2, bar1: 3 bar2: 4, bar3: 5},
  {foo: 3, bar1: 4 bar2: 5, bar4: 6},
  etc
  ]
  </code></pre>
  <p>I want to eliminate some redundant results from this array. Specifically, I want to eliminate any results where foo, bar1, and bar2 are identical across multiple objects, which can easily be done like so:</p>
  <p><code>array.uniq! { |object| [object.foo, object.bar1, object.bar2] }</code></p>
  <p>However, there is an <strong>additional edge case</strong> where I must also eliminate one of the following objects, which I don't know how to solve:</p>
  <pre><code>{foo: 1, bar1: 3 bar2: 2,...}
  {foo: 1, bar1: 2 bar2: 3,...}
  </code></pre>
  <p>Specifically, bar1 and bar2 may be switched in some of the data, and I want to only have unique results where those two are collectively the same pair. (2, 3 should be considered redundant as 3, 2).</p>