From afc31dc77db02244b736bc1138d39b2ed1f634ea Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sun, 4 Jan 2026 19:09:41 +0000 Subject: [PATCH] [DOC] Doc for Pathname.new --- lib/pathname_builtin.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/pathname_builtin.rb b/lib/pathname_builtin.rb index 878603d..4aef2b9 100644 --- a/lib/pathname_builtin.rb +++ b/lib/pathname_builtin.rb @@ -207,10 +207,20 @@ class Pathname # :startdoc: + # call-seq: + # Pathname.new(path) -> new_pathname # - # Create a Pathname object from the given String (or String-like object). - # If +path+ contains a NUL character (\0), an ArgumentError is raised. + # Returns a new \Pathname object for the given +path+, + # which must be a string or a string-like object; + # +path+ may be relative or absolute: # + # Pathname.new('lib/pathname') # => # + # Pathname.new('/usr/bin') # => # + # + # The new pathname stores a copy of +path+, so that later changes + # to that object do not affect the pathname. + # + # Raises ArgumentError if +path+ contains the null character "\0". def initialize(path) @path = File.path(path).dup rescue TypeError => e