Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Pathname#exist?
() -> bool
exist? → true or false
pathname_builtin.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/pathname_builtin.rb, line 2380
def exist?() FileTest.exist?(@path) end
Returns whether the entry represented by self exists:
Example
Pathname('.').exist? # => true Pathname('README.md').exist? # => true Pathname('nosuch').exist? # => false
See also
#executable_real?
#expand_path
#executable?
#extname
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0