From: George Date: 2009-06-01T16:22:33+09:00 Subject: [ruby-core:23655] Re: Counterpart to File.extname --0016e6475cfc7e6f41046b443372 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit FWIW, there is a precedent: man 1 basename . It was no doubt modelled after this. I agree a more intention-revealing name would be desirable. George. On Mon, Jun 1, 2009 at 2:29 AM, Martin DeMello wrote: > On Mon, Jun 1, 2009 at 6:11 AM, Michael Fellinger > wrote: > > require 'pathname' > > > > fn = Pathname('/a/b/c/d.e') > > # # > > > > fn.dirname + fn.basename('.*') > > # # > > Passing a suffix to basename is pretty unintuitive - I'd never have > thought to look there. File.split (and/or Pathname#split) seems a lot > cleaner to me. > > martin > > --0016e6475cfc7e6f41046b443372 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable FWIW, there is a precedent: man 1 basename .=A0 It was no doubt modelled af= ter this.

I agree a more intention-revealing name would be desirable= .

George.

On Mon, Jun 1, 2009 at 2= :29 AM, Martin DeMello <martindemello@gmail.com> wrote= :
On Mon, Jun = 1, 2009 at 6:11 AM, Michael Fellinger <m.fellinger@gmail.com> wrote:
> require 'pathname'
>
> fn =3D Pathname('/a/b/c/d.e')
> # #<Pathname:/a/b/c/d.e>
>
> fn.dirname + fn.basename('.*')
> # #<Pathname:/a/b/c/d>

Passing a suffix to basename is pretty unintuitive - I'd never ha= ve
thought to look there. File.split (and/or Pathname#split) seems a lot
cleaner to me.

martin


--0016e6475cfc7e6f41046b443372--