dirname:
File.dirname("/foo/bar")
# => "/foo"
dirname . Per :
, , .
, :
File.dirname("/foo/bar/baz.txt")
# => "/foo/bar"
-.
Pathname, Ruby. File, Dir, FileUtils, FileTest , , , .
require 'pathname'
dir = Pathname.new("/foo/bar/baz.txt")
dir.mkpath
Pathname , .