Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Pathname#executable?

() -> bool
executable? → true or false

Returns whether the entry represented by self exists and is executable by the effective owner/group of the current process.

Example
Pathname('/bin/ruby').executable?   # => true
Pathname('/etc').executable?        # => true
Pathname('/etc/passwd').executable? # => false
Pathname('nosuch').executable?      # => false

Note that some filesystem settings may cause this method to return true even though the entry is not executable by the effective owner/group.

See also #eql? #executable_real? #entries #exist? also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0