On Aug 14, 2:11 pm, Trans <transf... / gmail.com> wrote:
> On Aug 14, 2:40 am, "nikolai.weib... / gmail.com"

> > def same_path?(a, b)
> >   [a, b].map{ |p| File.expand_path(p).downcase }.apply(:==)
> > end
>
> Your first solution is much easier to understand. In fact I would do:

>  def same_path?(a, b)
>    File.expand_path(a).downcase == File.expand_path(b).downcase
>  end

It's not about the line count but about executing the same set of
functions/methods on both a and b.  With the #inject or #apply
solution it's clear that both a and b undergo the same conversion.

  nikolai