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

ruby-changes:61878

From: Nobuyoshi <ko1@a...>
Date: Sun, 21 Jun 2020 16:19:25 +0900 (JST)
Subject: [ruby-changes:61878] 995923b7f9 (master): [DOC] Mentioned that `Time.parse` method is not validator

https://git.ruby-lang.org/ruby.git/commit/?id=995923b7f9

From 995923b7f9178c234f8c685f434407eb4f0eeb5c Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 20 Jun 2020 19:21:35 +0900
Subject: [DOC] Mentioned that `Time.parse` method is not validator


diff --git a/lib/time.rb b/lib/time.rb
index b534c78..625c2c8 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -272,6 +272,11 @@ class Time https://github.com/ruby/ruby/blob/trunk/lib/time.rb#L272
     # Takes a string representation of a Time and attempts to parse it
     # using a heuristic.
     #
+    # This method **does not** function as a validator.  If the input
+    # string does not match valid formats strictly, you may get a
+    # cryptic result.  Should consider to use `Time.strptime` instead
+    # of this method as possible.
+    #
     #     require 'time'
     #
     #     Time.parse("2010-10-31") #=> 2010-10-31 00:00:00 -0500
-- 
cgit v0.10.2


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

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