Class: AntiVirusScanner
- Inherits:
-
Object
- Object
- AntiVirusScanner
- Includes:
- Morphine
- Defined in:
- app/services/anti_virus_scanner.rb
Overview
This is a simple wrapper for an underlying scanner; Without it, we’ll always going to be running actual anti-virus
Defined Under Namespace
Classes: VirusDetected
Constant Summary collapse
- NO_VIRUS_FOUND_RETURN_VALUE =
0
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #call(file_path) ⇒ Object
-
#initialize(object_with_pid) ⇒ AntiVirusScanner
constructor
A new instance of AntiVirusScanner.
Constructor Details
#initialize(object_with_pid) ⇒ AntiVirusScanner
Returns a new instance of AntiVirusScanner.
14 15 16 |
# File 'app/services/anti_virus_scanner.rb', line 14 def initialize(object_with_pid) @object = object_with_pid end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
13 14 15 |
# File 'app/services/anti_virus_scanner.rb', line 13 def object @object end |
Instance Method Details
#call(file_path) ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/services/anti_virus_scanner.rb', line 18 def call(file_path) if scanner_instance.call(file_path) == NO_VIRUS_FOUND_RETURN_VALUE return true else raise VirusDetected.new(object.pid, file_path) end end |