We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
File.path
1 parent 95ad4ce commit 8f582dcCopy full SHA for 8f582dc
1 file changed
lib/pathname_builtin.rb
@@ -212,17 +212,7 @@ class Pathname
212
# If +path+ contains a NUL character (<tt>\0</tt>), an ArgumentError is raised.
213
#
214
def initialize(path)
215
- unless String === path
216
- path = path.to_path if path.respond_to? :to_path
217
- path = path.to_str if path.respond_to? :to_str
218
- raise TypeError, "Pathname.new requires a String, #to_path or #to_str" unless String === path
219
- end
220
-
221
- if path.include?("\0")
222
- raise ArgumentError, "pathname contains \\0: #{path.inspect}"
223
224
225
- @path = path.dup
+ @path = File.path(path).dup
226
end
227
228
def freeze
0 commit comments