By DeepSource
All issues
Anti-pattern
Bug risk
Coverage
Documentation
Performance
Security
Style
Type check
File.dirname
Starting from Ruby 3.1, File.dirname can be called with a level argument, which is used to get the directory name by going up level amount of directories.
level
File.dirname(File.dirname(path))
File.dirname(path, 2)