mirror of
https://github.com/ruby/ruby.git
synced 2026-08-03 13:08:59 +08:00
[DOC] Doc for Pathname#to_s
This commit is contained in:
parent
7df1fefe21
commit
eec3aba7a3
Notes:
git
2026-07-12 19:20:56 +00:00
Merged: https://github.com/ruby/ruby/pull/17815 Merged-By: peterzhu2118 <peter@peterzhu.ca>
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user