class MarkdownExec::SavedFilesMatcher
most recent files.
It can list all matching files, retrieve the most recent file, or a list of
This class is responsible for matching saved files based on the given pattern.
SavedFilesMatcher
def self.list_all(folder, glob)
def self.list_all(folder, glob) Dir.glob(File.join(folder, glob)) end
def self.most_recent(folder, glob, arr = nil)
def self.most_recent(folder, glob, arr = nil) arr = list_all(folder, glob) if arr.nil? return if arr.count < 1 arr.max end
def self.most_recent_list(folder, glob, list_count, arr = nil)
Retrieves a list of the most recent files (up to list_count) from the specified folder
def self.most_recent_list(folder, glob, list_count, arr = nil) arr = list_all(folder, glob) if arr.nil? return if arr.empty? arr.sort[-[arr.count, list_count].min..].reverse end