Module: Ramaze::Helper::CGI
- Included in:
- Paginate::Paginator
- Defined in:
- lib/ramaze/helper/cgi.rb
Overview
Shortcuts to some CGI methods
Instance Method Summary collapse
-
#h(string) ⇒ Object
safely escape all HTML and code.
-
#html_escape(string) ⇒ Object
shortcut for Rack::Utils.escape_html.
-
#html_unescape(string) ⇒ Object
shortcut for CGI.unescapeHTML.
-
#url_decode(*args) ⇒ Object
shortcut for Rack::Utils.unescape.
-
#url_encode(*args) ⇒ Object
(also: #u)
shortcut for Rack::Utils.escape.
Instance Method Details
#h(string) ⇒ Object
safely escape all HTML and code
31 32 33 |
# File 'lib/ramaze/helper/cgi.rb', line 31 def h(string) Rack::Utils.escape_html(string).gsub(/#([{@$]@?)/, '#\1') end |
#html_escape(string) ⇒ Object
shortcut for Rack::Utils.escape_html
21 22 23 |
# File 'lib/ramaze/helper/cgi.rb', line 21 def html_escape(string) Rack::Utils.escape_html(string) end |
#html_unescape(string) ⇒ Object
shortcut for CGI.unescapeHTML
26 27 28 |
# File 'lib/ramaze/helper/cgi.rb', line 26 def html_unescape(string) ::CGI.unescapeHTML(string.to_s) end |
#url_decode(*args) ⇒ Object
shortcut for Rack::Utils.unescape
16 17 18 |
# File 'lib/ramaze/helper/cgi.rb', line 16 def url_decode(*args) Rack::Utils.unescape(*args.map{|a| a.to_s }) end |
#url_encode(*args) ⇒ Object Also known as: u
shortcut for Rack::Utils.escape
11 12 13 |
# File 'lib/ramaze/helper/cgi.rb', line 11 def url_encode(*args) Rack::Utils.escape(*args.map{|a| a.to_s }) end |