fix(ruby): sort files by modification time. Fix Bug 73654

This commit is contained in:
sshakndr
2025-03-25 11:48:16 +07:00
parent e4984f4c3e
commit a759f97508

View File

@ -169,11 +169,13 @@ class DocumentHelper
next if e.eql?('..')
next if File.directory?(File.join(directory, e)) # if the element is a directory, skip it
arr.push(e) # push the file to the array
file_path = File.join(directory, e)
arr.push([e, File.mtime(file_path)]) # push the file name and its modification time to the array
end
end
arr
arr.sort_by { |_, mtime| -mtime.to_i } # rubocop:disable Lint/NumberConversion
.map(&:first)
end
# create file meta information