From: Charles Comstock Date: 2004-07-19T03:12:10+09:00 Subject: Re: ruby idiom for parsing function arguments? zuzu wrote: > this may be a silly question, but can someone provide for me the ruby > idiom for parsing function arguments? it's not hard coded by array > position, is it? is there an idiom for testing arguments for meeting > criteria and the function making sense of what to do with them? for > example, parsing command line arguments which could be flags, a > url/location, a device, or stdin data... > > for anyone who has used cdrtools or cdrdao, i would like to avoid > requiring proper ordering, and instead relying on contextual inferance > of what arguments/flags are what (options, data, device/drive, etc.) > > tia, > -z > > optparse, getoptslong, getopts::declare are all for parsing commandline arguments, with optional positional or arbitrary orderings. Charles Comstock