[前][次][番号順一覧][スレッド一覧]

ruby-changes:41288

From: a_matsuda <ko1@a...>
Date: Tue, 29 Dec 2015 00:10:20 +0900 (JST)
Subject: [ruby-changes:41288] a_matsuda:r53360 (trunk): parsedate is no more available since 1.9

a_matsuda	2015-12-29 00:10:10 +0900 (Tue, 29 Dec 2015)

  New Revision: 53360

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53360

  Log:
    parsedate is no more available since 1.9

  Modified files:
    trunk/ext/tk/sample/tkbiff.rb
    trunk/ext/tk/sample/tkfrom.rb
Index: ext/tk/sample/tkfrom.rb
===================================================================
--- ext/tk/sample/tkfrom.rb	(revision 53359)
+++ ext/tk/sample/tkfrom.rb	(revision 53360)
@@ -1,11 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ext/tk/sample/tkfrom.rb#L1
 #!/usr/bin/env ruby
 # frozen_string_literal: false
 
-require "parsedate"
 require "base64"
 
-include ParseDate
-
 class Mail
   def Mail.new(f)
     if !f.kind_of?(IO)
@@ -107,7 +104,10 @@ for file in ARGV https://github.com/ruby/ruby/blob/trunk/ext/tk/sample/tkfrom.rb#L104
       from = mail.header['From']
       subj = mail.header['Subject']
       y = m = d = 0
-      y, m, d = parsedate(date) if date
+      if date
+        date = Date.parse(date) if date
+        y, m, d = date.year, date.mon, date.mday
+      end
       from = "sombody@somewhere" unless from
       subj = "(nil)" unless subj
       from = decode_b(from)
Index: ext/tk/sample/tkbiff.rb
===================================================================
--- ext/tk/sample/tkbiff.rb	(revision 53359)
+++ ext/tk/sample/tkbiff.rb	(revision 53360)
@@ -19,11 +19,8 @@ else https://github.com/ruby/ruby/blob/trunk/ext/tk/sample/tkbiff.rb#L19
   $spool = ARGV[0]
 end
 
-require "parsedate"
 require "base64"
 
-include ParseDate
-
 class Mail
   def Mail.new(f)
     if !f.kind_of?(IO)
@@ -128,7 +125,10 @@ def pop_up https://github.com/ruby/ruby/blob/trunk/ext/tk/sample/tkbiff.rb#L125
     date, from, subj =  mail.header['Date'], mail.header['From'], mail.header['Subject']
     next if !date
     y = m = d = 0
-    y, m, d = parsedate(date) if date
+    if date
+      date = Date.parse(date)
+      y, m, d = date.year, date.month, date.mday
+    end
     from = "sombody@somewhere" if ! from
     subj = "(nil)" if ! subj
     from = decode_b(from)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]