Module: Innate::Helper::CGI
- Defined in:
- lib/innate/helper/cgi.rb
Class Method Summary collapse
-
.html_and_code_escape(input) ⇒ Object
(also: h)
safely escape all HTML and code.
-
.html_escape(input) ⇒ String
Shortcut for Rack::Utils.escape_html.
-
.html_unescape(input) ⇒ String
Shortcut for CGI.unescapeHTML.
-
.url_decode(input) ⇒ String
Shortcut for Rack::Utils.unescape.
-
.url_encode(input) ⇒ String
(also: u)
Shortcut for Rack::Utils.escape.
Class Method Details
.html_and_code_escape(input) ⇒ Object Also known as: h
safely escape all HTML and code
45 46 47 |
# File 'lib/innate/helper/cgi.rb', line 45 def html_and_code_escape(input) Rack::Utils.escape_html(input.to_s).gsub(/#([{@$]@?)/, '#\1') end |
.html_escape(input) ⇒ String
Shortcut for Rack::Utils.escape_html
32 33 34 |
# File 'lib/innate/helper/cgi.rb', line 32 def html_escape(input) Rack::Utils.escape_html(input.to_s) end |
.html_unescape(input) ⇒ String
Shortcut for CGI.unescapeHTML
40 41 42 |
# File 'lib/innate/helper/cgi.rb', line 40 def html_unescape(input) ::CGI.unescapeHTML(input.to_s) end |
.url_decode(input) ⇒ String
Shortcut for Rack::Utils.unescape
24 25 26 |
# File 'lib/innate/helper/cgi.rb', line 24 def url_decode(input) Rack::Utils.unescape(input.to_s) end |
.url_encode(input) ⇒ String Also known as: u
Shortcut for Rack::Utils.escape
15 16 17 |
# File 'lib/innate/helper/cgi.rb', line 15 def url_encode(input) Rack::Utils.escape(input.to_s) end |