title: Getting rid of ruby stdin/stdout buffering
body: <p>I'm trying to write a ruby script to filter the output of a tailed file (<code>tail -f log.log | ./my_filter.rb</code>). I believe I've set stdin and stdout to be read synchronously, but I still see my output coming out in delayed batches, 20 or so lines at a time, rather than in realtime.</p>
  <p>I can reproduce the problem with code as simple as:</p>
  <pre><code>#!/usr/bin/ruby     
                  
  $stdout.sync = true 
  $stdin.sync = true  
                  
  ARGF.each do |line| 
    puts line         
  end                 
  </code></pre>
  <p>Am I missing a setting to eliminate buffering, or something along those lines?</p>
  <p><strong>Edit</strong>: To clarify, if I just <code>tail -f</code> the log then I see many lines written per second.</p>