Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Pathname#mkdir
(?::Integer perm) -> ::Integer
mkdir(permissions = 0755) → 0
pathname_builtin.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/pathname_builtin.rb, line 2906
def mkdir(...) Dir.mkdir(@path, ...) end
Creates a directory in the underlying file system at the path in self, with the given permissions; see File Permissions:
Example
Dir.mkdir('foo') File.stat(Dir.new('foo')).mode.to_s(8) # => "40775" Dir.mkdir('bar', 0644) File.stat(Dir.new('bar')).mode.to_s(8) # => "40644" Dir.rmdir('foo') Dir.rmdir('bar')
Argument permissions is ignored on Windows.