Project

General

Profile

Feature #12194

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

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://github.com/ruby/ruby/compare/trunk...nobu:feature/dirname-level?expand=1

Back