On Mon, 19 Jul 2004 03:12:10 +0900, Charles Comstock <cc1 / cec.wustl.edu> wrote: > > > 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 1.) information on this looks scarce. other than just reading optparse.rb, if anyone has an URLs on this, please provide them. 2.) i would like to clarify, that this is not necessarily for reading ruby, the interpreter, or chmod +x .rb files, shell command lines. this should apply to any function/method's arguments; as in object.method(arg1, arg2, arg3). thanks! -z