Class: Ddr::Antivirus::ScanResult

Inherits:
Object
  • Object
show all
Defined in:
lib/ddr/antivirus/scan_result.rb

Overview

The result of a virus scan.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path, output, scanned_at: nil, version: nil) ⇒ ScanResult

Returns a new instance of ScanResult.



9
10
11
12
13
14
# File 'lib/ddr/antivirus/scan_result.rb', line 9

def initialize(file_path, output, scanned_at: nil, version: nil)
  @file_path  = file_path
  @output     = output
  @scanned_at = scanned_at || default_time
  @version    = version    || default_version
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



7
8
9
# File 'lib/ddr/antivirus/scan_result.rb', line 7

def file_path
  @file_path
end

#outputObject (readonly)

Returns the value of attribute output.



7
8
9
# File 'lib/ddr/antivirus/scan_result.rb', line 7

def output
  @output
end

#scanned_atObject (readonly)

Returns the value of attribute scanned_at.



7
8
9
# File 'lib/ddr/antivirus/scan_result.rb', line 7

def scanned_at
  @scanned_at
end

#versionObject (readonly)

Returns the value of attribute version.



7
8
9
# File 'lib/ddr/antivirus/scan_result.rb', line 7

def version
  @version
end

Instance Method Details

#default_timeTime

Default time of virus scan - i.e., now.

Returns:

  • (Time)

    the time.



18
19
20
# File 'lib/ddr/antivirus/scan_result.rb', line 18

def default_time
  Time.now.utc
end

#default_versionString

Default anti-virus software version information.

Returns:

  • (String)

    the version.



24
25
26
# File 'lib/ddr/antivirus/scan_result.rb', line 24

def default_version
  "ddr-antivirus #{Ddr::Antivirus::VERSION}"
end

#to_sString

String representation of the result

Returns:

  • (String)

    the representation.



30
31
32
# File 'lib/ddr/antivirus/scan_result.rb', line 30

def to_s
  "#{output}\n[#{version}]"
end