summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam Daniels <adam@mediadrive.ca>2024-02-25 03:36:37 -0500
committergit <svn-admin@ruby-lang.org>2024-02-25 08:36:42 +0000
commitc16b507563b72b33277e9b9745cb1e41e1bcf93f (patch)
treea2d57c59cedb3ddfcaca3c5ec8861b8702f7ea50 /lib
parentc0c56d1714b44d30d69b51127f9c97df21322d58 (diff)
[ruby/tmpdir] [DOC] `require` inside each method on Dir
(https://github.com/ruby/tmpdir/pull/31) https://github.com/ruby/tmpdir/commit/a1ec977923
Diffstat (limited to 'lib')
-rw-r--r--lib/tmpdir.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb
index 70bd010de5..65c86e9b90 100644
--- a/lib/tmpdir.rb
+++ b/lib/tmpdir.rb
@@ -22,6 +22,9 @@ class Dir
##
# Returns the operating system's temporary file path.
+ #
+ # require 'tmpdir'
+ # Dir.tmpdir # => "/tmp"
def self.tmpdir
['TMPDIR', 'TMP', 'TEMP', ['system temporary path', SYSTMPDIR], ['/tmp']*2, ['.']*2].find do |name, dir|
@@ -45,6 +48,11 @@ class Dir
# Dir.mktmpdir creates a temporary directory.
#
+ # require 'tmpdir'
+ # Dir.mktmpdir {|dir|
+ # # use the directory
+ # }
+ #
# The directory is created with 0700 permission.
# Application should not change the permission to make the temporary directory accessible from other users.
#