diff options
-rw-r--r-- | lib/fileutils.rb | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/fileutils.rb b/lib/fileutils.rb index a2ad0c003e..69de458665 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -837,13 +837,8 @@ module FileUtils def compare_stream(a, b) bsize = fu_stream_blksize(a, b) - if RUBY_VERSION > "2.4" - sa = String.new(capacity: bsize) - sb = String.new(capacity: bsize) - else - sa = String.new - sb = String.new - end + sa = String.new(capacity: bsize) + sb = String.new(capacity: bsize) begin a.read(bsize, sa) @@ -1292,12 +1287,7 @@ module FileUtils opts = {} opts[:encoding] = fu_windows? ? ::Encoding::UTF_8 : path.encoding - files = if Dir.respond_to?(:children) - Dir.children(path, **opts) - else - Dir.entries(path(), **opts) - .reject {|n| n == '.' or n == '..' } - end + files = Dir.children(path, **opts) untaint = RUBY_VERSION < '2.7' files.map {|n| Entry_.new(prefix(), join(rel(), untaint ? n.untaint : n)) } |