Getoptlong

Hi all,

Using ruby 1.6.8 what’s the cleanest way of accessing a specific option
in getopt? From the looks of it, I have to iterate through with each,
and look for a specific option?

I can’t do something like options.get("–arg") which would be nice.

Daniel

···


Jan 16 Set uid bit patent issued, to Dennis Ritchie, 1979
Jan 16 Prohibition begins, 1920
Jan 16 Martyrs Day in Benin

Ack! no replies, well, to save one who would replied, I ended up doing
this:

class GetoptLong
def
self.each { |opt,arg| return arg if key.eql?(opt) }
end
end

which means I can use my options just like a hash.
quite nice.

db

···

On Fri, Jan 17, 2003 at 07:40:46AM +0900, Daniel Bretoi wrote:

Hi all,

Using ruby 1.6.8 what’s the cleanest way of accessing a specific option
in getopt? From the looks of it, I have to iterate through with each,
and look for a specific option?

I can’t do something like options.get(“–arg”) which would be nice.

Daniel


Jan 16 Set uid bit patent issued, to Dennis Ritchie, 1979
Jan 16 Prohibition begins, 1920
Jan 16 Martyrs Day in Benin


Jan 16 Set uid bit patent issued, to Dennis Ritchie, 1979
Jan 16 Prohibition begins, 1920
Jan 16 Martyrs Day in Benin