[DOC] Doc for Pathname#to_s

This commit is contained in:
Burdette Lamar 2026-07-12 14:20:26 -05:00 committed by GitHub
parent 7df1fefe21
commit eec3aba7a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2026-07-12 19:20:56 +00:00
Merged: https://github.com/ruby/ruby/pull/17815

Merged-By: peterzhu2118 <peter@peterzhu.ca>

View File

@ -281,12 +281,21 @@ class Pathname
@path.hash
end
# Return the path as a String.
# :markup: markdown
#
# call-seq:
# to_s -> string
#
# Returns a copy of the string path in `self`:
#
# ```ruby
# Pathname('nosuch/foo/bar').to_s # => "nosuch/foo/bar"
# ```
#
def to_s
@path.dup
end
# to_path is implemented so Pathname objects are usable with File.open, etc.
alias to_path to_s
def inspect # :nodoc: