I myself have found Pathname harder or less elegant to use than the direct File* or Dir* methods so I am in support of the suggestion by nobu.
So to Benoit, I understand that you may consider File.dirname(path, 2) not ideal either (a user may wonder what the 2 means), the alternative
suggestion to use Pathname is not ideal either and additionally requires one to require pathname for that toplevel Pathname() method and
subsequent use of pathname:
require 'pathname'
# require 'fileutils'; FileUtils.mkdir_p('/tmp/foobar/') # <-- this line just for testing purpose, disregard it
Pathname("/tmp/foobar/").parent.parent.to_s # => "/"
Being able to directly do so on File.dirname() itself is good, in my opinion.