What do you mean, more explanatory?

On Aug 3, 2012, at 10:03 AM, Panagiotis Atmatzidis <ml / convalesco.org> wrote=
:

> Hello,
>=20
> I'd like to make an OptParser error look a bit more explanatory. I tried t=
o deal with it outside OpiontParser like this:
>=20
> ----------------------------------------------------
> # check if options[:no] is interger
>=20
> if options[:no]=20
>        begin
>                $no =3D Integer(options[:no])
>        rescue ArgumentError
>                puts "#{$no} is not an Integer!"
>        else
>                true
>        end    =20
> else
>        $no =3D 0
> end
> ----------------------------------------------------
> but didn't work. The error I get from cli is:
>=20
> f2bread.rb:483:in `<main>': invalid argument: -s duck (OptionParser::Inval=
idArgument)
>=20
> Apparently I need to somehow handle this from within OptionParser. Any ide=
as on how to proceed?  I found this post[1] online which explains what I wan=
t but I couldn't figure how exactly it works. So some actual codes with a so=
rt of explanation of where *exactly* sits on the program (outside or inside "=
OptionParser.new" class?).
>=20
> The relevant OptionParser lines, where is specified that '-n' accepts Inte=
gers, are:
> ----------------------------------------------------
> opts.on('-n', '--no N', Integer, 'Number of top entries to be displayed. B=
y default all entries are displayed.') do |no|
>                options[:no] =3D no
>        end
> ----------------------------------------------------
>=20
> [1] http://blog.segment7.net/2008/01/05/optionparser-argument-casting
>=20
> Best Regards,
>=20
> Panagiotis Atmatzidis
> -----------------------------
> Pharmacy Student at VFU
>=20
> email4lists:    ml / convalesco.org
> More info:    http://about.me/atmosx
>=20
> The wise man said: "Never argue with an idiot, he brings you down to his l=
evel and beat you with experience."
>=20
>=20
>=20
>=20
>=20