From: "Berger, Daniel" Date: 2006-05-16T23:19:37+09:00 Subject: Re: GetoptLong Accessing the values with out looping > -----Original Message----- > From: Paul D. Kraus [mailto:paul.kraus@gmail.com] > Sent: Tuesday, May 16, 2006 8:13 AM > To: ruby-talk ML > Subject: Re: GetoptLong Accessing the values with out looping > > > > > > opts = {} and gl.each{|k,v| opts[k.delete('-')] = v} > > > Makes perfect sense in this example you are still looping > through the options. All though this is better on the eyes. > > I was hoping that the instance of getoptlong had some kind of > method to get the value of one of the command line options. > > Paul Yes, it sucks. That's why I wrote the 'getopt' package. gem install getopt :) require 'getopt/long' include Getopt opts = Getopt::Long.new(['-d', '--date', REQUIRED]) if opts['d'] # ... end Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.