From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 0F56A17DB70D for ; Mon, 7 Sep 2015 09:37:57 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 33DDFB5D8B7 for ; Mon, 7 Sep 2015 09:59:28 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 2D8D697A826 for ; Mon, 7 Sep 2015 09:59:29 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 0B51E952441 for ; Mon, 7 Sep 2015 09:59:26 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 1CA65120510; Mon, 7 Sep 2015 09:59:23 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id 67383120510 for ; Mon, 7 Sep 2015 09:59:19 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=CQ6onNIQqcRD9g7QPklE6e6GZXk=; b=Z0yLn57e+Dcj82emnR 9RSeZ95kbgJxms86j7pwL/Go3ODbM0vyowOQcyg4KOPzDUWpnDjLvRk6aNHm2S+5 r66E1yjmk5Qhp+H14EjGs3/j8UiTeIk+/qLKX5hHnUbFPwtO+J2UADZdbGT6ruhG Ec6lGeRhEvbJV2WbhHmdEUG08= Received: by filter0590p1mdw1.sendgrid.net with SMTP id filter0590p1mdw1.18588.55ECE16214 2015-09-07 00:59:14.506318871 +0000 UTC Received: from herokuapp.com (ec2-54-83-109-59.compute-1.amazonaws.com [54.83.109.59]) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id u1rhNTKtT2Gcb2aNN6EAqw Mon, 07 Sep 2015 00:59:14.563 +0000 (UTC) Date: Mon, 07 Sep 2015 00:59:14 +0000 From: shibata.hiroshi@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 45290 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11037 X-Redmine-Issue-Author: cfis X-Redmine-Issue-Assignee: akr X-Redmine-Sender: hsbt X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS7Tdtb5QJuk4VCnx2QA+9GCSrpH6rRCc2VdzS wrytCJbpWR4FAh9KRAtVGUeAwL0sVplPdJcwPgLRxfaW3kZFaHi6Tc/cHFe3OfgfJAxt8iqkTI7Tyq /nvVnb2DzqiUro1nHIXJbLtJYub2cf4NZLkt X-SendGrid-Contentd-ID: {"test_id":"1441587555"} X-ML-Name: ruby-core X-Mail-Count: 70673 Subject: [ruby-core:70673] [Ruby trunk - Bug #11037] [Assigned] Time Parse Documentation Incorrect - Undefined method getlocal X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11037 has been updated by Hiroshi SHIBATA. Status changed from Open to Assigned Assignee set to Akira Tanaka ---------------------------------------- Bug #11037: Time Parse Documentation Incorrect - Undefined method getlocal https://bugs.ruby-lang.org/issues/11037#change-54067 * Author: Charlie Savage * Status: Assigned * Priority: Normal * Assignee: Akira Tanaka * ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- According to: http://ruby-doc.org/stdlib-2.2.1/libdoc/time/rdoc/Time.html `Time#parse` can take a 2nd parameter: > We can change the date used to infer our missing elements by passing a second object that responds to mon, day and year, such as `Date`, `Time` or `DateTime`. We can also use our own object. However, that is not correct: ~~~ruby irb(main):010:0> Time.parse('12:30 AM', Date.today) NoMethodError: undefined method `getlocal' for # from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:262:in `make_time' from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:364:in `parse' from (irb):10 from C:/mingw64/mingw64/local/ruby/bin/irb:11:in `
' ~~~ The problem is in `Time#make_time`, lines 259 through 263: ~~~ruby if off now = now.getlocal(off) if now.utc_offset != off else now = now.getlocal end ~~~ The behavior the documentation does seem desirable, so the code above should check if the now parameter responds to `getlocal` or not (only `Time` does, `Date` and `DateTime` do not). Or of course the documentation should be updated to specify that a time object must be passed as the now parameter. ---Files-------------------------------- time_parse.patch (1.3 KB) -- https://bugs.ruby-lang.org/