from the doc: Class: ARGF (Ruby 2.0.0)
ARGF#skip :- Sets the current file to the next file in ARGV. If there
aren’t any more files it has no effect.
Tried the codes as below:
Code - I:
p RUBY_VERSION
p ARGF.argv
ARGF.skip #>B
p ARGF.argv #> A
Output:
D:\Rubyscript>ruby true.rb a.txt b.txt
“2.0.0”
[“a.txt”, “b.txt”]
[“a.txt”, “b.txt”]
Question- Why after the line B, line in A printing all the file names?
Code II:
p RUBY_VERSION
p ARGF.argv
ARGF.skip #>A
p ARGF.filename #>B
p ARGF.argv
output:
D:\Rubyscript>ruby true.rb a.txt b.txt
“2.0.0”
[“a.txt”, “b.txt”]
“a.txt”
[“b.txt”]
Question- Why after the line A, line in B printing a.txt
as current
file?
output doesn’t match with the official doc,after skip
.
On Wed, Mar 27, 2013 at 3:28 AM, Pritam D. [email protected]
wrote:
from the doc: Class: ARGF (Ruby 2.0.0)
honestly, ARGF is just one of those things I don’t get.
On Wed, Mar 27, 2013 at 9:28 AM, Pritam D. [email protected]
wrote:
p ARGF.argv
Question- Why after the line B, line in A printing all the file names?
I suggest you report a bug.
$ ruby -v
ruby 1.9.3p385 (2013-02-06 revision 39114) [i386-cygwin]
$ ruby -e ‘p ARGF.argv; p ARGF.gets; ARGF.skip; p ARGF.argv; p
ARGF.to_a; p ARGF.argv’ <(seq 1 5) <(seq 10 15)
[“/dev/fd/63”, “/dev/fd/62”]
“1\n”
[“/dev/fd/62”]
[“10\n”, “11\n”, “12\n”, “13\n”, “14\n”, “15\n”]
[]
Cheers
robert
Robert K. wrote in post #1103343:
On Wed, Mar 27, 2013 at 9:28 AM, Pritam D. [email protected]
wrote:
p ARGF.argv
Question- Why after the line B, line in A printing all the file names?
I suggest you report a bug.
I don’t know how to do that.
Any help on the same?
Thanks,
Robert K. wrote in post #1103343:
On Wed, Mar 27, 2013 at 9:28 AM, Pritam D. [email protected]
wrote:
p ARGF.argv
Question- Why after the line B, line in A printing all the file names?
I suggest you report a bug.
Thanks for your feedback and support. I have raised the bug ticket.