Robert Klemme wrote: >> >>**********************CUT HERE********************** >>def check(*tests) >> stack = caller.map {|m| m[/\w*(?=')/]}.compact.reverse.join " " >> tests.inject(true) {|ret, t| puts "#{(v=eval(t)) ? 'pass' : > > 'FAIL'} > >>.... (#{stack}) #{t.strip}"; ret && v} >>end >>**********************CUT HERE********************** >> >>What do you think about it? > > > - you're omitting the file info as far as I can see Yes, but that's not really needed, because: stack = caller.map {|m| m[/\w*(?=')/]}.compact.reverse.join " " does everything you need. > - I'd move the v=eval(t) out of the string replacement, no need to have it > there. You are right. It's a bit longer, but much better in terms of understandability. > + #inject is even more performant since you omit the intermediate array of > results. Yes, even if the combine_results method performs all the check anyway, while inject appears to stop as soon as a false value is reached. Not a big issue, in any case. Ciao, Giuliano -- If you want to send me an email in the address you have to write 'p', then a dot, followed by 'bossi' at 'quinary', another dot and 'com' at last