On Jan 25, 6:00 ¨Âí¬ Ôïâù Òïä÷åì¼ôòïä÷®®®Àéåå®ïòç¾ ÷òïôåº
> I would like to build a hash from ARGV using UNIX type notation ie any
> argument which begins with a hyphen or double hyphen is an option and
> may have as value(s) the argument(s) which succeed it (if they don't
> have hyphens).  ¨Âðôéïîó ÷éôèïõöáìõåó óèïõìä òåóõìô éî èáóè åìåíåî> which has a key and a dummy value (say "0").
>
> I suspect/hope there is a very simple "Ruby way" to do this, but I got
> stuck thinking how to look ahead when iterating through ARGV.  ¨Â§öçï> a bodged method of just taking pairs eg -a 1 -b 0 -c 3 etc, but it would
> be nice to it properly.  ¨Âîù óõççåóôéïîó¿  ¨Âìì èåìð áððòåãéáôåä¡

  $ gem install facets
  $ irb
  > require 'facets/argvector'
  > argv = Argvector.new("-a 0 -b 0 -c 3")
  > argv.options


> Posted viahttp://www.ruby-forum.com/.