Trans
6/21/2007 2:51:00 PM
On Jun 21, 4:04 am, "Robert Dober" <robert.do...@gmail.com> wrote:
> On 6/21/07, Trans <transf...@gmail.com> wrote:
>
> > Ah, so we need a patch. Okay well I guess I'll post that up on the
> > board too.
>
> Yes definitely ARGV is hardcoded, I was however fooling around, trying
> to make a patch in less than a minute, which worked ;).
>
> If you really want to send up a patch, please consider this one (it is
> a correct patch created with diff -u this time too):
>
> It does *not* temper with internal state, just allows an array to be
> passed to #each or #get. I tested it with this use case:
>
> ------------------ 8< -------------------------
> require 'getoptlong'
>
> opt = GetoptLong.new([ '-x', GetoptLong::NO_ARGUMENT ],[ '-b',
> GetoptLong::REQUIRED_ARGUMENT])
>
> blk = lambda do
> |*v|
> puts v.join(": ")
> end
> opt.dup.each %w{ -x -b 1024}, &blk
>
> opt.dup.each %w{ -b 4096 }, &blk
> ------------------------------ 8<---------------------------
>
> Please note the necessity of dup for reuse, I did not want to bother
> with internal state of a class I do not understand and I have no time
> to dig into :(.
>
> Cheers
> Robert
I think i would be better to do:
def argslist
@argslist ||= ARGV # or ARGV.dup
end
def argslist=(array)
@argslist = array.to_ary
end
and then /argslist/ARGV/g
T.