title: more ruby way of gsub from array
body: <p>My goal is to let there be <code>x</code> so that <code>x("? world. what ? you say...", ['hello', 'do'])</code> returns <code>"hello world. what do you say..."</code>.</p>
  
  <p>I have something that works, but seems far from the "Ruby way":</p>
  
  <pre><code>def x(str, arr, rep='?')
    i = 0
    query.gsub(rep) { i+=1; arr[i-1] }
  end
  </code></pre>
  
  <p>Is there a more idiomatic way of doing this? (Let me note that speed is the most important factor, of course.) </p>