Skip to content

Commit 054a43e

Browse files
committed
Switch to path.include?("\0") as it is faster than /\0/.match?(path)
1 parent c58bd4f commit 054a43e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/pathname.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class Pathname
239239
#
240240
def initialize(path)
241241
path = path.to_path if path.respond_to? :to_path
242-
if /\0/.match?(path)
242+
if path.include?("\0")
243243
raise ArgumentError, "pathname contains \\0: #{path.inspect}"
244244
end
245245

0 commit comments

Comments
 (0)