instance method
delete_prefixed
Ruby on Rails edge
Since v5.2.8.1Signature
delete_prefixed(prefix)
No documentation comment.
Parameters
-
prefixreq
Source
# File activestorage/lib/active_storage/service/disk_service.rb, line 59
def delete_prefixed(prefix)
instrument :delete_prefixed, prefix: prefix do
prefix_path = path_for(prefix)
# File.expand_path (called within path_for) strips trailing slashes.
# Restore trailing separator if the original prefix had one, so that
# the glob "prefix/*" matches files inside the directory, not siblings
# whose names start with the prefix string.
prefix_path += "/" if prefix.end_with?("/")
escaped = escape_glob_metacharacters(prefix_path)
Dir.glob("#{escaped}*").each do |path|
FileUtils.rm_rf(path)
end
end
end
Defined in activestorage/lib/active_storage/service/disk_service.rb line 59
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Service::DiskService