summaryrefslogtreecommitdiff
path: root/lib/time.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-05 02:47:53 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-05 02:47:53 +0000
commitc2a87a1fa138936dc8dca1b66fb719eec7f00b3a (patch)
treec04e4440c5484653c9879e164924d78ae4a2be34 /lib/time.rb
parenta72f9f34767f9f2a6e8b7e22251949e65d2fe39d (diff)
* lib/time.rb (Time.strptime): Raise ArgumentError if Date._strptime
doesn't extract date information. Reported by tadayoshi funaba. [ruby-core:62349] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/time.rb')
-rw-r--r--lib/time.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/time.rb b/lib/time.rb
index b8e3b22998..a10c20bedc 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -416,6 +416,9 @@ class Time
force_zone!(t, zone)
end
else
+ if !d[:year] && !d[:mon] && !d[:mday] && !d[:hour] && !d[:min] && !d[:sec] && !d[:sec_fraction]
+ raise ArgumentError, "no time information in #{date.inspect}"
+ end
year = d[:year]
year = yield(year) if year && block_given?
t = make_time(year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)