demarches-normaliennes/app/jobs/virus_scanner_job.rb
2019-05-02 15:58:09 +02:00

10 lines
288 B
Ruby

class VirusScannerJob < ApplicationJob
def perform(blob)
metadata = extract_metadata_via_virus_scanner(blob)
blob.update!(metadata: blob.metadata.merge(metadata))
end
def extract_metadata_via_virus_scanner(blob)
ActiveStorage::VirusScanner.new(blob).metadata
end
end