why not make the first `if` a compound condition test a là `if path.exist? && path.basename.to_s != '.git'`? &lt;/nit&gt;