gets looks to ARGV, if populated, for its source of data. That is its
I want to:
- use ARGV to point to a directory I want to process and
- use gets to inquire whether the user wants the program to proceed
with that directory.
I thought I might be able to reset ARGV to an empty array after I
saved its content, but that doesn’t work. Is there a way around this.
The following code never pauses to allow the user to enter yes/no, as
I intended it to. Is there a workaround?
=== Code ==
puts “ARGV = %s” % ARGV.join(", ")
argv = ARGV # Save ARGV’s content
ARGV =  # Reset ARGV to an empty array
puts “Delete indicated item [yes, no]”
response = gets.chomp # doesn’t go to STDIN !!!
puts case response
when /^yes$/i; “Deleting”
when /^no$/i; “Quiting”