diff options
author | Semyon Pupkov <mail@semyonpupkov.com> | 2017-11-13 14:48:29 +0500 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-08-04 09:19:30 +0900 |
commit | 4173258fd0413c49ef07d54bc9654bba7e497e89 (patch) | |
tree | 74f0024198404b5b455eaed5b0c39d5a9076e468 /lib/cgi/util.rb | |
parent | 8e7df4bbf991b9d605784225db0750bbfe681f23 (diff) | |
download | ruby-4173258fd0413c49ef07d54bc9654bba7e497e89.tar.gz |
change call CGI methods from :: to .
Closes: https://github.com/ruby/ruby/pull/1749
Diffstat (limited to 'lib/cgi/util.rb')
-rw-r--r-- | lib/cgi/util.rb | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb index 464115262f..aab8b000cb 100644 --- a/lib/cgi/util.rb +++ b/lib/cgi/util.rb @@ -7,7 +7,7 @@ end module CGI::Util @@accept_charset="UTF-8" unless defined?(@@accept_charset) # URL-encode a string. - # url_encoded_string = CGI::escape("'Stop!' said Fred") + # url_encoded_string = CGI.escape("'Stop!' said Fred") # # => "%27Stop%21%27+said+Fred" def escape(string) encoding = string.encoding @@ -17,7 +17,7 @@ module CGI::Util end # URL-decode a string with encoding(optional). - # string = CGI::unescape("%27Stop%21%27+said+Fred") + # string = CGI.unescape("%27Stop%21%27+said+Fred") # # => "'Stop!' said Fred" def unescape(string,encoding=@@accept_charset) str=string.tr('+', ' ').b.gsub(/((?:%[0-9a-fA-F]{2})+)/) do |m| @@ -36,7 +36,7 @@ module CGI::Util } # Escape special characters in HTML, namely '&\"<> - # CGI::escapeHTML('Usage: foo "bar" <baz>') + # CGI.escapeHTML('Usage: foo "bar" <baz>') # # => "Usage: foo "bar" <baz>" def escapeHTML(string) enc = string.encoding @@ -60,7 +60,7 @@ module CGI::Util end # Unescape a string that has been HTML-escaped - # CGI::unescapeHTML("Usage: foo "bar" <baz>") + # CGI.unescapeHTML("Usage: foo "bar" <baz>") # # => "Usage: foo \"bar\" <baz>" def unescapeHTML(string) enc = string.encoding @@ -118,10 +118,10 @@ module CGI::Util end end - # Synonym for CGI::escapeHTML(str) + # Synonym for CGI.escapeHTML(str) alias escape_html escapeHTML - # Synonym for CGI::unescapeHTML(str) + # Synonym for CGI.unescapeHTML(str) alias unescape_html unescapeHTML # Escape only the tags of certain HTML elements in +string+. @@ -132,30 +132,30 @@ module CGI::Util # The attribute list of the open tag will also be escaped (for # instance, the double-quotes surrounding attribute values). # - # print CGI::escapeElement('<BR><A HREF="url"></A>', "A", "IMG") + # print CGI.escapeElement('<BR><A HREF="url"></A>', "A", "IMG") # # "<BR><A HREF="url"></A>" # - # print CGI::escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"]) + # print CGI.escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"]) # # "<BR><A HREF="url"></A>" def escapeElement(string, *elements) elements = elements[0] if elements[0].kind_of?(Array) unless elements.empty? string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/i) do - CGI::escapeHTML($&) + CGI.escapeHTML($&) end else string end end - # Undo escaping such as that done by CGI::escapeElement() + # Undo escaping such as that done by CGI.escapeElement() # - # print CGI::unescapeElement( - # CGI::escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG") + # print CGI.unescapeElement( + # CGI.escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG") # # "<BR><A HREF="url"></A>" # - # print CGI::unescapeElement( - # CGI::escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"]) + # print CGI.unescapeElement( + # CGI.escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"]) # # "<BR><A HREF="url"></A>" def unescapeElement(string, *elements) elements = elements[0] if elements[0].kind_of?(Array) @@ -168,10 +168,10 @@ module CGI::Util end end - # Synonym for CGI::escapeElement(str) + # Synonym for CGI.escapeElement(str) alias escape_element escapeElement - # Synonym for CGI::unescapeElement(str) + # Synonym for CGI.unescapeElement(str) alias unescape_element unescapeElement # Abbreviated day-of-week names specified by RFC 822 @@ -182,7 +182,7 @@ module CGI::Util # Format a +Time+ object as a String using the format specified by RFC 1123. # - # CGI::rfc1123_date(Time.now) + # CGI.rfc1123_date(Time.now) # # Sat, 01 Jan 2000 00:00:00 GMT def rfc1123_date(time) t = time.clone.gmtime @@ -196,13 +196,13 @@ module CGI::Util # +string+ is the HTML string to indent. +shift+ is the indentation # unit to use; it defaults to two spaces. # - # print CGI::pretty("<HTML><BODY></BODY></HTML>") + # print CGI.pretty("<HTML><BODY></BODY></HTML>") # # <HTML> # # <BODY> # # </BODY> # # </HTML> # - # print CGI::pretty("<HTML><BODY></BODY></HTML>", "\t") + # print CGI.pretty("<HTML><BODY></BODY></HTML>", "\t") # # <HTML> # # <BODY> # # </BODY> |