Surprise? ARGVundefined after processing ARGF

I found this behavior surprising. Is it
intentional (and therefore something I need
to understand better), or is it a bug:

 print_usage if ARGV[0] == nil
 puts ARGV[0]  # => filename

 # Parse the document
 @doc = Document.new ARGF.read()
 puts ARGV[0]  # => nil

Hi,

In message “Re: Surprise? ARGV[0] undefined after processing ARGF”
on Thu, 22 Jun 2006 10:19:00 +0900, Eric A.
[email protected] writes:
|I found this behavior surprising. Is it
|intentional (and therefore something I need
|to understand better), or is it a bug:

Intentional. Processed file names are removed from ARGV to tell you
how far you have done already.

						matz.

Ok.
Thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs