Skip to content

Commit

Permalink
[ruby/pathname] require fileutils in both methods using it
Browse files Browse the repository at this point in the history
rmtree is already requiring fileutils, but mkpath apparently relies on
autoload of FileUtils. Switch to require for both methods

ruby/pathname@07ad1fb41a
  • Loading branch information
toy authored and matzbot committed Dec 28, 2023
1 parent 73fa322 commit 1f1edee
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ext/pathname/lib/pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -580,14 +580,13 @@ def find(ignore_error: true) # :yield: pathname
end


autoload(:FileUtils, 'fileutils')

class Pathname # * FileUtils *
# Creates a full path, including any intermediate directories that don't yet
# exist.
#
# See FileUtils.mkpath and FileUtils.mkdir_p
def mkpath(mode: nil)
require 'fileutils'
FileUtils.mkpath(@path, mode: mode)
nil
end
Expand Down

0 comments on commit 1f1edee

Please sign in to comment.