On 8/18/05, Daniel Berger <Daniel.Berger / qwest.com> wrote:
> Hi all,
> 
> A recent discussion on file renaming made me wonder something about
> File.basename.
> 
> Is there any reason that the suffix shouldn't default to ".*" ?
> 
> Current behavior:  File.basename("foo.rb") # -> "foo.rb"
> Proposed behavior: File.basename("foo.rb") # -> "foo"
> 
> The current behavior just seems rather pointless to me.  Or is there a
> good reason for not setting the suffix to a default value?
> 
> Regards,
> 
> Dan
> 
> 


You'd lose the capability to grab just the filename out of a path then.

File.basename('/home/users/foo/bar.rb') # => "bar.rb"