From: larry fast Date: 2013-04-27T13:40:02+09:00 Subject: Is there an elegant way to turn optparser.on() into a one-liner? I'm looking at my code for optparser and it's ugly. For 90% of my options all I really want is a one-liner but the standard form for opts.on() is... opts.on( '-f', '--file FILE', 'output file' ) do |file| @params.file = file end Is there any way to clean that down to a one-liner like: @params.file = opts.on_str( '-f', '--file FILE', 'output file' ).value I've tried adding a new method to optparse, but I can't figure out how to pass the list-of-args in. -- Posted via http://www.ruby-forum.com/.