Class: ClamAV::Commands::ScanCommand

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

Instance Method Summary collapse

Constructor Details

#initialize(path, path_finder = Util) ⇒ ScanCommand

Returns a new instance of ScanCommand.



23
24
25
# File 'lib/clamav/commands/scan_command.rb', line 23

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

Instance Method Details

#call(conn) ⇒ Object



27
28
29
# File 'lib/clamav/commands/scan_command.rb', line 27

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

#scan_file(conn, file) ⇒ Object



31
32
33
# File 'lib/clamav/commands/scan_command.rb', line 31

def scan_file(conn, file)
  get_status_from_response(conn.send_request("SCAN #{file}"))
end