[ruby-core:102862] [Ruby master Feature#12194] File.dirname optional parameter
From:
mame@...
Date:
2021-03-15 06:08:09 UTC
List:
ruby-core #102862
Issue #12194 has been updated by mame (Yusuke Endoh).
Matz has already accepted this proposal at the previous meeting.
https://github.com/ruby/dev-meeting-log/blob/master/DevelopersMeeting20210216Japan.md#feature-12194-filedirname-optional-parameter-nobu
----------------------------------------
Feature #12194: File.dirname optional parameter
https://bugs.ruby-lang.org/issues/12194#change-90920
* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Priority: Normal
----------------------------------------
As talked at the last developers' meeting, I propose an addition of an optional parameter to `File.dirname`.
Often I see the code, like
```ruby
File.dirname(File.dirname(path)) # or
File.expand_path("../..", path)
```
which are not concise.
This proposal can make them as:
```ruby
File.dirname(path, 2)
```
[Patch](https://github.com/ruby/ruby/pull/4111)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>