Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. 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.2 · 3.1 · 3.0