summaryrefslogtreecommitdiff
path: root/lib/cgi/util.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-09-03 13:39:47 +0900
committergit <svn-admin@ruby-lang.org>2021-09-03 17:50:00 +0900
commit62fc81fe124d4de35153aad5df0dcf21dafdddc6 (patch)
tree183e6f83b6d2d4cfc9086af2f3c61c67432bd5c4 /lib/cgi/util.rb
parent250b86bbee0235574d7496afd548d6f97da83134 (diff)
[ruby/cgi] Use Time#strftime
https://github.com/ruby/cgi/commit/caf1d0755d
Diffstat (limited to 'lib/cgi/util.rb')
-rw-r--r--lib/cgi/util.rb11
1 files changed, 1 insertions, 10 deletions
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb
index 69a252b5e36..55e61bf984f 100644
--- a/lib/cgi/util.rb
+++ b/lib/cgi/util.rb
@@ -179,21 +179,12 @@ module CGI::Util
# Synonym for CGI.unescapeElement(str)
alias unescape_element unescapeElement
- # Abbreviated day-of-week names specified by RFC 822
- RFC822_DAYS = %w[ Sun Mon Tue Wed Thu Fri Sat ]
-
- # Abbreviated month names specified by RFC 822
- RFC822_MONTHS = %w[ Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ]
-
# Format a +Time+ object as a String using the format specified by RFC 1123.
#
# CGI.rfc1123_date(Time.now)
# # Sat, 01 Jan 2000 00:00:00 GMT
def rfc1123_date(time)
- t = time.clone.gmtime
- return format("%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT",
- RFC822_DAYS[t.wday], t.day, RFC822_MONTHS[t.month-1], t.year,
- t.hour, t.min, t.sec)
+ time.getgm.strftime("%a, %d %b %Y %T GMT")
end
# Prettify (indent) an HTML string.