title: Replacing characters in Ruby string according to some rule
body: <p>In Ruby, I have a string of identical characters -- let's say they're all exclamation points, as in <code>!!!!</code>. I would like to replace the characters at certain indices with '*' if the integer corresponding to that index meets some criteria.</p>
  
  <p>For example, let's say I want to replace all the characters whose indices are even numbers and are greater than 3. In the string <code>!!!!!!!!</code> (8 characters long), that results in <code>!!!!*!*!</code> (indices 4 and 6 have been replaced).</p>
  
  <p>What's the most compact way to do this?</p>