### Home Classes Methods

### In Files

- lib/facets/cgi.rb

### Parent

Object

### Methods

- #esc
- #escformat
- #marshal_from_cgi
- #marshal_to_cgi

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Random
- Random::ArrayExtensions
- Random::HashExtensions
- Random::IntegerExtensions
- Random::NumericExtensions
- Random::RangeExtensions
- Random::StringExtensions
- Random::StringExtensions::Self
- FileUtils
- FileUtils::DryRun
- FileUtils::NoWrite
- FileUtils::Verbose
- Digest
- Digest::Class
- Digest::Instance
- Multiton
- Multiton::Inclusive
- Multiton::MetaMethods
- URI
- URI::Hash
- URI::Kernel
- Argvector
- Argvector
- ERB
- ERB::OpenTemplate
- Enumerable
- Enumerable::Arguments
- GetoptLong
- GetoptLong::DSL
- Memoizable
- Memoizable::Copy
- Numeric
- Numeric::Multipliers
- Object
- Object::ArgVector
- Timer
- Timer::Dummy
- Array
- BasicObject
- CGI
- Cloneable
- Continuation
- Date
- DateTime
- Equitable
- File
- Find
- Hash
- Instantiable
- Integer
- Interval
- Kernel
- Math
- Module
- Net
- NilClass
- NullClass
- OpEsc
- OpenStruct
- Pathname
- Platform
- Range
- RbConfig
- Set
- Shellwords
- String
- StringScanner
- Time
- Tuple
- YAML
- Zlib

No matching classes.

# CGI

### Public Instance Methods

esc(str) click to toggle source

Return an html "safe" version of the string, where every &, < and > are replaced with appropriate entities.

    # File lib/facets/cgi.rb, line 26
    def esc(str)
      str.gsub(/&/,'&amp;').gsub(/</,'&lt;').gsub(/>/,'&gt;')
    end

escformat(str) click to toggle source

Calls esc, and then further replaces carriage returns and quote characters with entities.

    # File lib/facets/cgi.rb, line 31
    def escformat(str)
      esc(str).gsub(/[\r\n]+/,'&#13;&#10;').gsub(%"|,'&quot;').gsub(%'|,'&#39;')
    end

marshal_from_cgi(name) click to toggle source

Create an hidden input field through which an object can can be marshalled. This makes it very easy to pass from data between requests.

    # File lib/facets/cgi.rb, line 14
    def marshal_from_cgi(name)
      if self.params.has_key?("__#{name}__")
        return Marshal.load(CGI.unescape(self["__#{name}__"][0]))
      end
    end

marshal_to_cgi(name, iobj) click to toggle source

Create an hidden input field through which an object can can be marshalled. This makes it very easy to pass from data betwenn requests.

    # File lib/facets/cgi.rb, line 7
    def marshal_to_cgi(name, iobj)
      data = CGI.escape(Marshal.dump(iobj))
      return %{<input type="hidden" name="__#{name}__" value="#{data}"/>\n}
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.