Method: Path#dirname
- Defined in:
- lib/rubypath/path_operations.rb
#dirname ⇒ Path Also known as: parent
Return path to parent directory. If path is already an absolute or relative root nil will be returned.
167 168 169 170 171 172 |
# File 'lib/rubypath/path_operations.rb', line 167 def dirname return nil if %w[. /].include? internal_path dir = ::File.dirname internal_path dir.empty? ? nil : self.class.new(dir) end |