Skip to content

Commit 7690309

Browse files
committed
Mention that require 'pathname' is necessary for #find, #rmtree and .mktmpdir
* See https://bugs.ruby-lang.org/issues/21640#note-16
1 parent f53b819 commit 7690309

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/pathname.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class Pathname # * Find *
1515
# Iterates over the directory tree in a depth first manner, yielding a
1616
# Pathname for each file under "this" directory.
1717
#
18+
# Note that you need to require 'pathname' to use this method.
19+
#
1820
# Returns an Enumerator if no block is given.
1921
#
2022
# Since it is implemented by the standard library module Find, Find.prune can
@@ -40,6 +42,8 @@ def find(ignore_error: true) # :yield: pathname
4042
class Pathname # * FileUtils *
4143
# Recursively deletes a directory, including all directories beneath it.
4244
#
45+
# Note that you need to require 'pathname' to use this method.
46+
#
4347
# See FileUtils.rm_rf
4448
def rmtree(noop: nil, verbose: nil, secure: nil)
4549
# The name "rmtree" is borrowed from File::Path of Perl.
@@ -53,6 +57,8 @@ def rmtree(noop: nil, verbose: nil, secure: nil)
5357
class Pathname # * tmpdir *
5458
# Creates a tmp directory and wraps the returned path in a Pathname object.
5559
#
60+
# Note that you need to require 'pathname' to use this method.
61+
#
5662
# See Dir.mktmpdir
5763
def self.mktmpdir
5864
require 'tmpdir' unless defined?(Dir.mktmpdir)

0 commit comments

Comments
 (0)