File: webrick/htmlutils.rb

Overview
Module Structure
Code

Overview

Module Structure

  module: <Toplevel Module>
  module: WEBrick#11
  module: HTMLUtils#12
has properties
function: escape / 1 #14

Code

   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, '&amp;')
  17        str.gsub!(/\"/n, '&quot;')
  18        str.gsub!(/>/n, '&gt;')
  19        str.gsub!(/</n, '&lt;')
  20        str
  21      end
  22      module_function :escape
  23 
  24    end
  25  end