Ruaで簡単なフィルタを作る

もはや、何言語だか。
$stdoutは渡して大丈夫かな?

require "cgi"
require 'open-uri'
require 'rua'

cgi = CGI.new
print cgi.header("text/html")

rua = Rua.new(:base, :string)
rua.stdout = $stdout
rua.open = OpenURI.method(:open_uri)

rua.eval(<<EOS)
  open('http://d.hatena.ne.jp/winebarrel/', function(f)
    f.each(function(l)
      l = string.gsub(l, '。', 'にゃ。')
      stdout.puts(l)
    end)
  end)
EOS