class method
Pathname.new
(::string | ::Pathname) -> ::Pathname
new(path)
pathname_builtin.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/pathname_builtin.rb, line 214
def initialize(path)
@path = File.path(path).dup
rescue TypeError => e
raise e.class, "Pathname.new requires a String, #to_path or #to_str", cause: nil
end
Create a Pathname object from the given String (or String-like object). If path contains a NUL character (\0), an ArgumentError is raised.