PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > with OptionParser
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
with OptionParser

Réponse
 
LinkBack Outils de la discussion
Vieux 07/01/2008, 20h20   #1
Bryan Richardson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut with OptionParser

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

Hello all,

I'm needing some 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 "--":String (NoMethodError)

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

Thanks! -- BTR

  Réponse avec citation
Vieux 07/01/2008, 20h26   #2
Giles Bowkett
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: with OptionParser

> I'm needing some 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 "--":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.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

  Réponse avec citation
Vieux 07/01/2008, 20h51   #3
Bryan Richardson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: with OptionParser

[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 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 "--":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.blogspot.com
> Blog: http://gilesbowkett.blogspot.com
> Portfolio: http://www.gilesgoatboy.org
> Tumblelog: http://giles.tumblr.com
>
>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 18h18.


Édité par : vBulletin® version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08254 seconds with 11 queries