Keith Fahlgren
3/20/2006 6:21:00 PM
On Monday 20 March 2006 1:13 pm, bcorrigan78@gmail.com wrote:
> Hey all,
>
> I must be doing something wrong here. Im calling the following file
> this way:
> ruby script.rb -s 1234
> or
> ruby script.rb -s1111
>
> #Code snip
> require 'optparse'
> opts = OptionParser.new
> opts.on("-s", "--size VAL", Integer) do |val|
> puts "-s #{val}"
> puts val
> end
I think the "Integer" is unnecessary. Here's how I usually use it:
opts.on("-p", "--prefix NAME", "REQUIRED: Set the prefix NAME (like
'ldpg').") {|p| $prefix = p}
HTH,
Keith