From: "Brian F. Feldman" Date: 2000-10-11T01:03:12+09:00 Subject: [ruby-talk:5388] Re: Allowing *ary's in the middle of a camma separated list "Akinori MUSHA" wrote: > At Tue, 10 Oct 2000 14:24:28 +0900, > Yukihiro Matsumoto wrote: > > How about this? > > > > system 'rcsdiff', *(options+["-r#{revold}", "-r#{revnew}", "#{root}/#{file},v"]) > > Well, yes, that's supposed to work, but I simply do not feel it's as > pretty as other parts of Ruby. I mean, I just couldn't explain why > "proc(a, b, *c)" is allowed and "proc(a, *b, c)" or "proc(a, *b, *c)" > is not, considering Ruby's consistent nature. > > Is it hard to implement that, or does it decrease Ruby's cleanness in > any sense? (I'm not pushing so hard, but just curious :) I ran into this problem last week, and my workaround was to change a little what I was doing: def to_s border = '+---' * @width + "+\n" rowfmt = "| %-2s" * @width + "|\n" + border string = border.dup @board.each {|row| string.concat format(rowfmt, *row) } string end Previously, I had the non-working (but, I guess, maybe cleaner) code as follows. I'm going by memory because for some reason I didn't use CVS until I was late in the game of writing this ;): def to_s border = '+---' * @width + "+\n" string = border.dup @board.each {|row| string.concat format("| %-2s" * @width + "|\n%s", *row, border) } string end If it's not too much work, I'd also appreciate this ability. -- Brian Fundakowski Feldman \ FreeBSD: The Power to Serve! / green@FreeBSD.org `------------------------------'