Avoid calling nested method two times
You should consider any DRYing efforts in terms of its effects on code clarity. I don't think that trying to reduce foo(foo(bar)) is worth the reduced clarity. Now, if we're trying to reduce foo(foo(foo(foo(foo(bar))))), that's something else. One way you can do that is using reduce:

5.times.reduce(1 &lt;&lt; 64) { |x,| Math.sqrt(x) }
=&gt; 4.0

5.times.reduce('/a/b/c/d/e/f.txt') { |x,| File.dirname(x) }
=&gt; "/a"