title: Ruby - Permutations, lack of outputs
body: <pre><code>def permutations(str)
    str.split(//).permutation.with_index.to_a.delete_if{|x,i| x[i].eql? x[i+1]}.flatten(1).to_a.delete_if{|x| x.class == Integer}.map{|x| x.join}
  end
  </code></pre>
  <p>Desc:
  &quot;In this kata you have to create all permutations of an input string and remove duplicates, if present. This means, you have to shuffle all letters from the input in all possible orders.&quot;</p>
  <p>Expected Input / Output:</p>
  <pre><code>permutations('aabb') # =&gt; ['aabb', 'abab', 'abba', 'baab', 'baba', 'bbaa']
  </code></pre>
  <p>My Input/ Output:</p>
  <pre><code>permutations('aabb') # =&gt;  [&quot;aabb&quot;, &quot;abab&quot;, &quot;abba&quot;]
  </code></pre>
  <p>So there is a problem with:</p>
  <pre><code>'baab', 'baba', 'bbaa'
  </code></pre>
  <p>Have You got any ideas? I'm sorry if my code doesn't look clear but can I set this kind of methods like this? :</p>
  <pre><code>str.split(//)
     .to_a
     .delete_if 
     .etc
  </code></pre>
  <p>I'm not sure but in my opinion it's problem with this part of code but I can't figure it out:</p>
  <pre><code>.delete_if{|x,i| x[i] == x[i+1]}
  </code></pre>