From: Eric Hodel Date: 2005-03-03T11:54:21+09:00 Subject: Re: optparse: on() vs on_tail() --Apple-Mail-52-514739234 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 02 Mar 2005, at 18:45, James Edward Gray II wrote: > Can someone tell me the difference between the on() and on_tail() > methods of OptionParser. I can't seem to figure it out. Thanks. from optparse.rb: =begin --- OptionParser#on(*opts) [{...}] --- OptionParser#def_option(*opts) [{...}] --- OptionParser#on_head(*opts) [{...}]--- OptionParser#def_head_option(*opts) [{...}] --- OptionParser#on_tail(*opts) [{...}] --- OptionParser#def_tail_option(*opts) [{...}] Defines option switch and handler. (({on_head})), (({def_head_option})) and (({on_tail})), (({def_tail_option})) put the switch at head and tail of summary, respectively. cf. (()). =end #'#"#`# If you read down from there, on_tail/on add things to the end, of the args list summary while on_head adds them to the front. It looks like on_tail only exists to make things pretty. -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --Apple-Mail-52-514739234 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCJnxJMypVHHlsnwQRAnLmAJ9kc6YZ1V6FEEcdhh2GaSmQflVZBgCgxn66 O3iMnECXq3gRhcbpO5x4HK4= =mXMA -----END PGP SIGNATURE----- --Apple-Mail-52-514739234--