From: noreply@... Date: 2006-10-12T01:26:01+09:00 Subject: [ ruby-Patches-6102 ] Date.parse raises NoMethodError Patches item #6102, was opened at 2006-10-11 16:25 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1700&aid=6102&group_id=426 Category: Ruby1.8 Group: None Status: Open Resolution: None Priority: 3 Submitted By: Kent Sibilev (kent) Assigned to: Nobody (None) Summary: Date.parse raises NoMethodError Initial Comment: In the version 1.8.4 Date.parse('-1') used to raise 'ArgumentError: invalid date' error. Now it raises NoMethodError: irb(main):002:0> Date.parse '-1' NoMethodError: undefined method `[]' for nil:NilClass from /usr/local/lib/ruby/1.8/date.rb:800:in `complete_hash' from /usr/local/lib/ruby/1.8/date.rb:875:in `new_with_hash' from /usr/local/lib/ruby/1.8/date.rb:922:in `parse' from (irb):2 from /usr/local/lib/ruby/1.8/rational.rb:174 The patch below fixes it: Index: lib/date.rb =================================================================== RCS file: /src/ruby/lib/date.rb,v retrieving revision 1.17.2.14 diff -u -r1.17.2.14 date.rb --- lib/date.rb 30 Sep 2006 06:13:16 -0000 1.17.2.14 +++ lib/date.rb 11 Oct 2006 14:22:00 -0000 @@ -797,7 +797,7 @@ end end - if g[0] == :time + if g && g[0] == :time if self <= DateTime d ||= Date.today elem[:jd] ||= d.jd ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1700&aid=6102&group_id=426