From: Robert Dober Date: 2007-06-22T07:03:27+09:00 Subject: Re: GetoptLong, but not on ARGV On 6/21/07, Nobuyoshi Nakada wrote: > Hi, > > At Thu, 21 Jun 2007 19:45:08 +0900, > Robert Dober wrote in [ruby-talk:256371]: > > Thanks nobu, does this fix it? > > Almost, but #terminate can be called outside #get. I think > getoptlong isn't designed for such usage. > > > @non_option_arguments.reverse_each do |argument| > > - ARGV.unshift(argument) > > + args.unshift(argument) > > end > > In short, this can be: > > args.unshift(*@non_option_arguments) I did not want to lecture ;) Hmm I am a little bit confused now because I have provided #terminate with a defaulted parameter for exactly the reason above. Anyway I think Tom's idea to use an instance variable @args (defaulting to ARGV) with an attribute accessor reflects the spirit of the original design much better. I will try to find half an hour to do that for fun this weekend and I will send it, feel free to use it or to loose it ;). Cheers Robert > > -- > Nobu Nakada > > -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw