Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Pathname#readable?
() -> bool
readable? → true or false
pathname_builtin.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/pathname_builtin.rb, line 2524
def readable?() FileTest.readable?(@path) end
Returns whether the entry at the path in self exists and is readable by the owner and group of the current process; see Permissions:
Example
pn = Pathname('/tmp/secret.txt') pn.write('foo') pn.readable? # => true pn.chmod(0o000) pn.readable? # => false pn.delete # Clean up. Pathname('nosuch').readable? # => false