[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Help with OptionParser

Bryan Richardson

1/7/2008 7:21:00 PM

[Note: parts of this message were removed to make it a legal post.]

Hello all,

I'm needing some help with OptionParser. I'm wanting to use it to parse a
string rather than ARGV, but when I pass the parse method a string of
options, i get the following error:

undefined method `shift' for "--help":String (NoMethodError)

Is there a way I can format the string of options so OptionParser can use
it?

Thanks! -- BTR

2 Answers

Giles Bowkett

1/7/2008 7:26:00 PM

0

> I'm needing some help with OptionParser. I'm wanting to use it to parse a
> string rather than ARGV, but when I pass the parse method a string of
> options, i get the following error:
>
> undefined method `shift' for "--help":String (NoMethodError)
>
> Is there a way I can format the string of options so OptionParser can use
> it?

AFAIK the easiest solution is to give it an array which contains just
one string.

--
Giles Bowkett

Podcast: http://hollywoodgrit.bl...
Blog: http://gilesbowkett.bl...
Portfolio: http://www.gilesg...
Tumblelog: http://giles....

Bryan Richardson

1/7/2008 7:51:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

Sweet! Thanks.

On Jan 7, 2008 12:26 PM, Giles Bowkett <gilesb@gmail.com> wrote:

> > I'm needing some help with OptionParser. I'm wanting to use it to parse
> a
> > string rather than ARGV, but when I pass the parse method a string of
> > options, i get the following error:
> >
> > undefined method `shift' for "--help":String (NoMethodError)
> >
> > Is there a way I can format the string of options so OptionParser can
> use
> > it?
>
> AFAIK the easiest solution is to give it an array which contains just
> one string.
>
> --
> Giles Bowkett
>
> Podcast: http://hollywoodgrit.bl...
> Blog: http://gilesbowkett.bl...
> Portfolio: http://www.gilesg...
> Tumblelog: http://giles....
>
>