title: All possible combinations of selected character substitution in a string in ruby
body: <p>I was wondering if there is a simple way to do every combination of selected character substitutions in ruby in a simple way.</p>
  
  <p>An example:</p>
  
  <pre><code>    string = "this is a test"
      subs = ['a'=&gt;'@','i'=&gt;'!','s'=&gt;'$']
      subs.combination.each { |c|
          string.gsub c
      }
  </code></pre>
  
  <p>would yield</p>
  
  <pre><code>    "this is @ test"
      "th!s !s a test"
      "thi$ i$ a te$t"
      "th!s !s @ test"
      "thi$ i$ @ te$t"
      "th!$ !$ a te$t"
      "th!$ !$ @ te$t"
  </code></pre>
  
  <p>Thanks for the help!</p>