Class: Hyrax::VirusScanner
- Inherits:
-
Object
- Object
- Hyrax::VirusScanner
- Defined in:
- app/models/hyrax/virus_scanner.rb
Overview
The default virus scanner ported from Hyrax::Works.
If ClamAV is present, it will be used to check for the presence of a virus. If ClamAV is not installed or otherwise not available to your application, Hyrax::Works does no virus checking add assumes files have no viruses.
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Class Method Summary collapse
Instance Method Summary collapse
- #infected? ⇒ Boolean
-
#initialize(file) ⇒ VirusScanner
constructor
A new instance of VirusScanner.
Constructor Details
#initialize(file) ⇒ VirusScanner
Returns a new instance of VirusScanner.
32 33 34 |
# File 'app/models/hyrax/virus_scanner.rb', line 32 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
23 24 25 |
# File 'app/models/hyrax/virus_scanner.rb', line 23 def file @file end |
Class Method Details
.infected?(file) ⇒ Boolean
28 29 30 |
# File 'app/models/hyrax/virus_scanner.rb', line 28 def self.infected?(file) new(file).infected? end |
Instance Method Details
#infected? ⇒ Boolean
Note:
Override this method to use your own virus checking software
40 41 42 43 44 45 46 47 48 |
# File 'app/models/hyrax/virus_scanner.rb', line 40 def infected? if defined?(Clamby) clamby_scanner elsif defined?(ClamAV) clam_av_scanner else null_scanner end end |