On Thu, 17 Mar 2005 10:12:57 +0900, Logan Capaldo wrote:

> optparser = OptionParser.new
> optparser.on("-D") do |arg|
>       gcc_inv.debug << arg
> end
> 
> The above is sloppy and mostly wrong, but I don't have Ruby on this
> machine to do it properly. Just an alternative idea. Especailly since
> you won't have to write a new regexp everytime you want to add a
> option to your class.

I suppose the problem with this approach is that optparse will raise an
exception for unspecified options. So, to get it to work correctly you'd
need to know all the possible options to gcc (and whether or not they take
an argument).

It'd be a really neat solution if this can be resolved!