Class: ClamAV::Commands::PatchScanCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/clamav/commands/patch_scan_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, path_finder = Util) ⇒ PatchScanCommand

Returns a new instance of PatchScanCommand.



27
28
29
30
31
# File 'lib/clamav/commands/patch_scan_command.rb', line 27

def initialize(path, path_finder = Util)
  @path = path
  @path_finder = path_finder
  super()
end

Instance Method Details

#call(conn) ⇒ Object



33
34
35
# File 'lib/clamav/commands/patch_scan_command.rb', line 33

def call(conn)
  @path_finder.path_to_files(@path).map { |file| scan_file(conn, file) }
end

#scan_file(conn, file) ⇒ Object



37
38
39
40
# File 'lib/clamav/commands/patch_scan_command.rb', line 37

def scan_file(conn, file)
  stripped_filename = file.gsub(%r{^clamav_tmp/}, '') # need to send the file
  get_status_from_response(conn.send_request("SCAN /vets-api/#{stripped_filename}"))
end