Module: Ramaze::Helper::CGI

Defined in:
lib/ramaze/helper/cgi.rb

Overview

Shortcuts to some CGI methods

Instance Method Summary collapse

Instance Method Details

#c(string) ⇒ Object



38
39
40
41
# File 'lib/ramaze/helper/cgi.rb', line 38

def c(string)
  Ramaze::deprecated("Helper::CGI#c", "Helper::CGI#h")
  h(string)
end

#h(string) ⇒ Object

safely escape all HTML and code



34
35
36
# File 'lib/ramaze/helper/cgi.rb', line 34

def h(string)
  ::CGI.escapeHTML(string.to_s).gsub(/#/, '#')
end

#html_escape(string) ⇒ Object

shortcut for CGI.escapeHTML



23
24
25
# File 'lib/ramaze/helper/cgi.rb', line 23

def html_escape(string)
  ::CGI.escapeHTML(string.to_s)
end

#html_unescape(string) ⇒ Object

shortcut for CGI.unescapeHTML



29
30
31
# File 'lib/ramaze/helper/cgi.rb', line 29

def html_unescape(string)
  ::CGI.unescapeHTML(string.to_s)
end

#url_decode(*args) ⇒ Object

shortcut for CGI.unescape



17
18
19
# File 'lib/ramaze/helper/cgi.rb', line 17

def url_decode(*args)
  ::CGI.unescape(*args.map{|arg| arg.to_s})
end

#url_encode(*args) ⇒ Object Also known as: u

shortcut for CGI.escape



11
12
13
# File 'lib/ramaze/helper/cgi.rb', line 11

def url_encode(*args)
  ::CGI.escape(*args.map{|arg| arg.to_s})
end