jocodeが必要。
require 'jcode' str="アイウエオ" str2= str.tr("ァ-ン","ぁ-ん") puts str2
require 'jcode' a=File.open(ARGV[0]);a.each{|str| str=str.gsub (/lya/,"ャ") str=str.gsub (/lyu/,"ュ") str=str.gsub (/lyo/,"ョ") str=str.gsub (/lwa/,"ヮ") str=str.gsub (/ltu/,"ッ") str=str.gsub (/va/,"ヴ") str=str.gsub (/lka/,"ヵ") str=str.gsub (/lke/,"ヶ") str=str.gsub (/_a/,"ア") str=str.gsub (/_i/,"イ") str=str.gsub (/_u/,"ウ") str=str.gsub (/_e/,"エ") str=str.gsub (/_o/,"オ") str=str.gsub (/ka/,"カ") str=str.gsub (/ki/,"キ") str=str.gsub (/ku/,"ク") str=str.gsub (/ke/,"ケ") str=str.gsub (/ko/,"コ") str=str.gsub (/sa/,"サ") str=str.gsub (/si/,"シ") str=str.gsub (/su/,"ス") str=str.gsub (/se/,"セ") str=str.gsub (/so/,"ソ") str=str.gsub (/ta/,"タ") str=str.gsub (/ti/,"チ") str=str.gsub (/tu/,"ツ") str=str.gsub (/te/,"テ") str=str.gsub (/to/,"ト") str=str.gsub (/na/,"ナ") str=str.gsub (/ni/,"ニ") str=str.gsub (/nu/,"ヌ") str=str.gsub (/ne/,"ネ") str=str.gsub (/no/,"ノ") str=str.gsub (/ha/,"ハ") str=str.gsub (/hi/,"ヒ") str=str.gsub (/hu/,"フ") str=str.gsub (/he/,"へ") str=str.gsub (/ho/,"ホ") str=str.gsub (/ma/,"マ") str=str.gsub (/mi/,"ミ") str=str.gsub (/mu/,"ム") str=str.gsub (/me/,"メ") str=str.gsub (/mo/,"モ") str=str.gsub (/ya/,"ヤ") str=str.gsub (/yu/,"ユ") str=str.gsub (/yo/,"ヨ") str=str.gsub (/ra/,"ラ") str=str.gsub (/ri/,"リ") str=str.gsub (/ru/,"ル") str=str.gsub (/re/,"レ") str=str.gsub (/ro/,"ロ") str=str.gsub (/wa/,"ワ") str=str.gsub (/wo/,"ヲ") str=str.gsub (/nn/,"ン") str=str.gsub (/la/,"ァ") str=str.gsub (/li/,"ィ") str=str.gsub (/lu/,"ゥ") str=str.gsub (/le/,"ェ") str=str.gsub (/lo/,"ォ") str=str.gsub (/ga/,"ガ") str=str.gsub (/gi/,"ギ") str=str.gsub (/gu/,"グ") str=str.gsub (/ge/,"ゲ") str=str.gsub (/go/,"ゴ") str=str.gsub (/za/,"ザ") str=str.gsub (/zi/,"ジ") str=str.gsub (/zu/,"ズ") str=str.gsub (/ze/,"ゼ") str=str.gsub (/zo/,"ゾ") str=str.gsub (/da/,"ダ") str=str.gsub (/di/,"ヂ") str=str.gsub (/du/,"ヅ") str=str.gsub (/de/,"デ") str=str.gsub (/do/,"ド") str=str.gsub (/ba/,"バ") str=str.gsub (/bi/,"ビ") str=str.gsub (/bu/,"ブ") str=str.gsub (/be/,"ベ") str=str.gsub (/bo/,"ボ") str=str.gsub (/pa/,"パ") str=str.gsub (/pi/,"ピ") str=str.gsub (/pu/,"プ") str=str.gsub (/pe/,"ぺ") str=str.gsub (/po/,"ポ") str=str.gsub (/lya/,"ャ") str=str.gsub (/lyu/,"ュ") str=str.gsub (/lyo/,"ョ") str=str.gsub (/lwa/,"ヮ") str=str.gsub (/ltu/,"ッ") str=str.gsub (/va/,"ヴ") str=str.gsub (/lka/,"ヵ") str=str.gsub (/lke/,"ヶ") puts str.tr("ァ-ン","ぁ-ん")}