From: nobu.nokada@... Date: 2002-04-11T22:53:31+09:00 Subject: Re: GetoptLong question Hi, At Thu, 11 Apr 2002 22:16:07 +0900, Daniel Berger wrote: > However, that trick doesn't seem to work, and the examples I've looked > at seem to expect you to iterate over each member at some point, > rather than picking them out individually like that. I realize > there's a 'get_option' method, but that only seems to grab them one at > a time off the command line, not actually grab one out of 'opt'. > > Is there a way to do this? If not, any chance of a 'contains' method? You need to make a hash once. def opt.to_hash tbl = {} each {|name, arg| tbl[name] = arg} tbl end opt = opt.to_hash if opt.key?('--debug') # or even 'if opt['--debug'] puts "Debug print" end And note that GetoptLong `canonicalize's option names to the first ones. -- Nobu Nakada