ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: nobu@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:92545] [Ruby trunk Bug#15823] ARGF.lineno behavior and documentation disagree
Date: Sun, 05 May 2019 05:29:18 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-77903.20190505052918.c80cff4986a13424@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15823.20190504165422@ruby-lang.org

Issue #15823 has been updated by nobu (Nobuyoshi Nakada).

Backport changed from 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN to 2.4: REQUIRED, 2.5: REQUIRED, 2.6: REQUIRED

Thank you, that document is wrong.

----------------------------------------
Bug #15823: ARGF.lineno behavior and documentation disagree
https://bugs.ruby-lang.org/issues/15823#change-77903

* 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: REQUIRED, 2.5: REQUIRED, 2.6: REQUIRED
----------------------------------------
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/

  parent reply	other threads:[~2019-05-05  5:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15823.20190504165422@ruby-lang.org>
2019-05-04 16:54 ` [ruby-core:92539] [Ruby trunk Bug#15823] ARGF.lineno behavior and documentation disagree jonny
2019-05-05  5:29 ` nobu [this message]
2019-07-31 14:15 ` [ruby-core:94075] [Ruby master " nagachika00
2019-07-31 14:58 ` [ruby-core:94078] " usa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-77903.20190505052918.c80cff4986a13424@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).