Methods
Included Modules
Public Instance methods
Return an html "safe" version of the string, where every &, < and > are replaced with appropriate entities.
[ show source ]
# File lib/facets/more/htmlhelper.rb, line 63 def esc(str) str.gsub(/&/,'&').gsub(/</,'<').gsub(/>/,'>') end
Calls esc, and then further replaces carriage returns and quote characters with entities.
[ show source ]
# File lib/facets/more/htmlhelper.rb, line 68 def escformat(str) esc(str).gsub(/[\r\n]+/,' ').gsub(%r|"|,'"').gsub(%r|'|,''') end
Create an hidden input field through which an object can can be marshalled. This makes it very easy to pass from data between requests.
[ show source ]
# File lib/facets/more/htmlhelper.rb, line 53 def marshal_from_cgi(name) if self.params.has_key?("__#{name}__") return Marshal.load(CGI.unescape(self["__#{name}__"][0])) end end
Create an hidden input field through which an object can can be marshalled. This makes it very easy to pass from data betwenn requests.
[ show source ]
# File lib/facets/more/htmlhelper.rb, line 46 def marshal_to_cgi(name, iobj) data = CGI.escape(Marshal.dump(iobj)) return %Q{<input type="hidden" name="__#{name}__" value="#{data}"/>\n} end