Stefano Crocco
8/22/2007 9:17:00 PM
Alle mercoledì 22 agosto 2007, David A. Black ha scritto:
> You can save yourself the double negative:
>
> for_every_app.values.all?{|f| File.exist?(f)}
>
> And even save the creation of an intermediate array of values:
>
> for_every_app.all?{|a,b| File.exist?(b)}
>
> But I repeat myself :-) (See my earlier post.)
>
>
> David
You're right. Somehow, I thought that all? needed to iterate over all the
values and any? didn't. Of course, now I realized that, just as any? will
stop at the first positive result, all? will stop at the first negative
result.
Stefano