Skip to content

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

instance method

File::Stat#executable?

stat.executable? → true or false

Returns true if stat is executable or if the operating system doesn’t distinguish executable files from nonexecutable files. The tests are made using the effective owner of the process.

Example
File.stat("testfile").executable?   #=> false
See also #directory? #executable_real? #dev_minor #file? also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0