1 # 2 # htmlutils.rb -- HTMLUtils Module 3 # 4 # Author: IPR -- Internet Programming with Ruby -- writers 5 # Copyright (c) 2000, 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou 6 # Copyright (c) 2002 Internet Programming with Ruby writers. All rights 7 # reserved. 8 # 9 # $IPR: htmlutils.rb,v 1.7 2002/09/21 12:23:35 gotoyuzo Exp $ 10 11 module WEBrick 12 module HTMLUtils 13 14 def escape(string) 15 str = string ? string.dup : "" 16 str.gsub!(/&/n, '&') 17 str.gsub!(/\"/n, '"') 18 str.gsub!(/>/n, '>') 19 str.gsub!(/</n, '<') 20 str 21 end 22 module_function :escape 23 24 end 25 end