title: Making a flashing console message with ruby
body: <pre><code>0.upto(9) do
      STDOUT.print "Flash!"
      sleep 0.5
      STDOUT.print "\b\b\b\b\b\b" # (6 backspaces, the length of "Flash!")
      sleep 0.5
  end
  </code></pre>
  
  <p>This code doesn't work. It prints <code>Flash!</code> to the screen, but it doesn't flash. It just stays there, as though the backspaces aren't taking effect. But I do this:</p>
  
  <pre><code>0.upto(9) do
      STDOUT.print "Flash!"
      sleep 0.5
      STDOUT.print "\b\b\b\b\b" # (5 backspaces, the length of "Flash! - 1")
      sleep 0.5
  end
  </code></pre>
  
  <p>and it almost works. It prints this: <code>FFFFFFFFFFlash!</code>(after 9 loops) Why do the backspaces stop taking effect when their number is equal to the length of the string they're deleting?</p>
  
  <p>How can I overcome this problem and create a flashing message, only using libraries that are part of rails?</p>
  
  <p>I tried a workaround like this:</p>
  
  <pre><code>0.upto(9) do
      STDOUT.print " Flash!"
      sleep 0.5
      STDOUT.print "\b\b\b\b\b\b"
      sleep 0.5
  
  end
  </code></pre>
  
  <p>(Note the space in <code>" Flash!"</code>), but what happens is the message appears to crawl across the screen! An interesting effect, but not what I want.</p>
  
  <p>I'm using Command Prompt with Ruby and Rails in Windows 7</p>