On Thu, Mar 3, 2011 at 12:15 AM, Markus Fischer <markus / fischer.name> wrote:

>    dirs_count[dir] =
>        Dir.entries(dir).collect { |e|
>            case e
>            when '.svn'
>                nil
>            when '.'
>                nil
>            when '..'
>                nil
>            else
>                e
>            end
>        }.compact.count
>

Instead of mapping values to nil and using compact, you can simply use
Enumerable#reject or #select. For this, though, since I think you can rely
on Dir.entries(dir).sort having "." and ".." as the first two entries, you
could get away with this:

Dir.entries(dir)[2..-1].reject { |e| e == ".svn" }