Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

File::Stat#mode

stat.mode → integer

Returns an integer representing the permission bits of stat. The meaning of the bits is platform dependent; on Unix systems, see stat(2).

Example
File.chmod(0644, "testfile")   #=> 1
s = File.stat("testfile")
sprintf("%o", s.mode)          #=> "100644"
See also #inspect #mtime #ino #nlink also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1