7stud2
(7stud --)
1
from the doc: http://www.ruby-doc.org/core-2.0/ARGF.html#method-i-skip
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`.
···
--
Posted via http://www.ruby-forum.com/.
honestly, ARGF is just one of those things I don't get.
···
On Wed, Mar 27, 2013 at 3:28 AM, Pritam Dey <lists@ruby-forum.com> wrote:
from the doc: Class: ARGF (Ruby 2.0.0)
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
···
On Wed, Mar 27, 2013 at 9:28 AM, Pritam Dey <lists@ruby-forum.com> wrote:
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?
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
7stud2
(7stud --)
4
Robert Klemme wrote in post #1103343:
···
On Wed, Mar 27, 2013 at 9:28 AM, Pritam Dey <lists@ruby-forum.com> > 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,
--
Posted via http://www.ruby-forum.com/\.
7stud2
(7stud --)
5
Robert Klemme wrote in post #1103343:
···
On Wed, Mar 27, 2013 at 9:28 AM, Pritam Dey <lists@ruby-forum.com> > 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.
--
Posted via http://www.ruby-forum.com/\.