From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 9714D1F45F for ; Sat, 4 May 2019 16:54:30 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 1670F120988; Sun, 5 May 2019 01:54:25 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 2A4F3120884 for ; Sun, 5 May 2019 01:54:21 +0900 (JST) Received: by filter0088p3iad2.sendgrid.net with SMTP id filter0088p3iad2-30446-5CCDC3BE-30 2019-05-04 16:54:22.904733047 +0000 UTC m=+163705.327774171 Received: from herokuapp.com (unknown [54.80.106.145]) by ismtpd0015p1iad2.sendgrid.net (SG) with ESMTP id xA3CyPPMS960tUViBLWG1w for ; Sat, 04 May 2019 16:54:23.137 +0000 (UTC) Date: Sat, 04 May 2019 16:54:22 +0000 (UTC) From: jonny@pluckeye.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 68022 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15823 X-Redmine-Issue-Author: plujon X-Redmine-Sender: plujon 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: =?us-ascii?Q?bkKk26JZvv=2FSCid3NaXSsKLy2RxYzntG9bw7GX5huqDqvF=2FK0CT6QE08Z54V7s?= =?us-ascii?Q?3HrH0VJbRO6slmkXC3JmJAxDdv91MUfEw6C+mU9?= =?us-ascii?Q?ZDKpIe8InFD=2FEHfIUl+KkxmrdisPQuowoOBF03N?= =?us-ascii?Q?mwZO2pTwCscOcIejvMCs9a7Tp0bYl7BdAlzkxUx?= =?us-ascii?Q?b3SMDmz9SXi=2FOz7eu1Q=2FOqgCqnA5gW1gJaA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92539 Subject: [ruby-core:92539] [Ruby trunk Bug#15823] ARGF.lineno behavior and documentation disagree 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #15823 has been reported by plujon (Jon Wilkes). ---------------------------------------- Bug #15823: ARGF.lineno behavior and documentation disagree https://bugs.ruby-lang.org/issues/15823 * Author: plujon (Jon Wilkes) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- The documentation for ARGF.each at http://ruby-doc.org/core-2.6.3/ARGF.html#method-i-each describes ARGF.lineno as if it behaved like ARGF.file.lineno, when it behaves for me like $. Here's the sample code from the documentation: ARGF.each_line do |line| puts ARGF.filename if ARGF.lineno == 1 puts "#{ARGF.lineno}: #{line}" end A shell one-liner demonstration: for i in a b; do echo $i>$i; done; ruby -e 'ARGF.each_line do print " #{ARGF.filename} #{ARGF.lineno}"; end; puts' a b a 1 b 2 The documents indicate that should be a 1 b 1' Are the documents correct or the implementation? -- https://bugs.ruby-lang.org/