From 7690309a0271fea9c8e6ce58afd90cd4c1afb85c Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sun, 26 Oct 2025 13:32:00 +0100 Subject: [PATCH] Mention that `require 'pathname'` is necessary for #find, #rmtree and .mktmpdir * See https://bugs.ruby-lang.org/issues/21640#note-16 --- lib/pathname.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/pathname.rb b/lib/pathname.rb index a0da5ed93f1dab..b19e379cd48d9b 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -15,6 +15,8 @@ class Pathname # * Find * # Iterates over the directory tree in a depth first manner, yielding a # Pathname for each file under "this" directory. # + # Note that you need to require 'pathname' to use this method. + # # Returns an Enumerator if no block is given. # # Since it is implemented by the standard library module Find, Find.prune can @@ -40,6 +42,8 @@ def find(ignore_error: true) # :yield: pathname class Pathname # * FileUtils * # Recursively deletes a directory, including all directories beneath it. # + # Note that you need to require 'pathname' to use this method. + # # See FileUtils.rm_rf def rmtree(noop: nil, verbose: nil, secure: nil) # The name "rmtree" is borrowed from File::Path of Perl. @@ -53,6 +57,8 @@ def rmtree(noop: nil, verbose: nil, secure: nil) class Pathname # * tmpdir * # Creates a tmp directory and wraps the returned path in a Pathname object. # + # Note that you need to require 'pathname' to use this method. + # # See Dir.mktmpdir def self.mktmpdir require 'tmpdir' unless defined?(Dir.mktmpdir)