summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2025-10-26 13:32:00 +0100
committerBenoit Daloze <eregontp@gmail.com>2025-10-26 14:03:45 +0100
commit7690309a0271fea9c8e6ce58afd90cd4c1afb85c (patch)
treed7cabb60865e32e12c75daa560933b57fae31303
parentf53b8194cd5958619dc295e51dbdec29351a6b0a (diff)
Mention that `require 'pathname'` is necessary for #find, #rmtree and .mktmpdir
* See https://bugs.ruby-lang.org/issues/21640#note-16
-rw-r--r--lib/pathname.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/pathname.rb b/lib/pathname.rb
index a0da5ed93f..b19e379cd4 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 @@ end
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 @@ end
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)