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
pathname_builtin.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/pathname_builtin.rb, line 2356
def executable?() FileTest.executable?(@path) end
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.