そのスクリプトのままで動いたよ

$ ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]

$ ruby hoge.rb
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
   :
<html lang="ja">
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=Windows-31J">
        <meta http-equiv="Content-Style-Type" content="text/css">
        <meta http-equiv="Content-Script-Type" content="text/javascript">
  :