Class: ClamScan::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/clam_scan/client.rb

Class Method Summary collapse

Class Method Details

.scan(opts = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/clam_scan/client.rb', line 4

def scan (opts={})
  response = Request.send(opts)

  if ::ClamScan.configuration.raise_unless_safe
    if response.virus?
      raise VirusDetected.new(response)
    elsif response.unknown?
      raise UnknownError.new(response)
    elsif !response.safe?
      raise ResponseError.new(response)
    end
  end

  response
end