diff --git a/pathname_builtin.rb b/pathname_builtin.rb index 88bc9bba9c..dc9f81a3b3 100644 --- a/pathname_builtin.rb +++ b/pathname_builtin.rb @@ -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: