Class: ClamScan::Response
- Inherits:
-
Object
- Object
- ClamScan::Response
- Defined in:
- lib/clam_scan/response.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
Returns the value of attribute output.
-
#process_status ⇒ Object
Returns the value of attribute process_status.
Instance Method Summary collapse
- #body ⇒ Object
- #error? ⇒ Boolean
-
#initialize(process_status, output) ⇒ Response
constructor
A new instance of Response.
- #safe? ⇒ Boolean
- #status ⇒ Object
- #unknown? ⇒ Boolean
- #virus? ⇒ Boolean
Constructor Details
#initialize(process_status, output) ⇒ Response
Returns a new instance of Response.
6 7 8 9 |
# File 'lib/clam_scan/response.rb', line 6 def initialize (process_status, output) @output = output @process_status = process_status end |
Instance Attribute Details
#output ⇒ Object
Returns the value of attribute output.
3 4 5 |
# File 'lib/clam_scan/response.rb', line 3 def output @output end |
#process_status ⇒ Object
Returns the value of attribute process_status.
4 5 6 |
# File 'lib/clam_scan/response.rb', line 4 def process_status @process_status end |
Instance Method Details
#body ⇒ Object
11 12 13 |
# File 'lib/clam_scan/response.rb', line 11 def body @output end |
#error? ⇒ Boolean
15 16 17 |
# File 'lib/clam_scan/response.rb', line 15 def error? status == :error end |
#safe? ⇒ Boolean
19 20 21 |
# File 'lib/clam_scan/response.rb', line 19 def safe? status == :safe end |
#status ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/clam_scan/response.rb', line 23 def status case @process_status.exitstatus when 0 :safe when 1 :virus when 2 :error else :unknown end end |
#unknown? ⇒ Boolean
36 37 38 |
# File 'lib/clam_scan/response.rb', line 36 def unknown? status == :unknown end |
#virus? ⇒ Boolean
40 41 42 |
# File 'lib/clam_scan/response.rb', line 40 def virus? status == :virus end |