module Ddr::Antivirus

Constants

VERSION

Attributes

logger[RW]
scanner_adapter[RW]

Public Class Methods

configure() { |self| ... } click to toggle source
# File lib/ddr/antivirus.rb, line 16
def configure
  yield self
end
get_adapter() click to toggle source

@return [Class] the scanner adapter class

# File lib/ddr/antivirus.rb, line 37
def get_adapter
  if scanner_adapter.nil?
    raise Error, "`Ddr::Antivirus.scanner_adapter` is not configured."
  end
  require_relative "antivirus/adapters/#{scanner_adapter}_scanner_adapter"
  adapter_name = scanner_adapter.to_s.capitalize + "ScannerAdapter"
  self.const_get(adapter_name, false)
end
scan(path) click to toggle source
# File lib/ddr/antivirus.rb, line 20
def scan(path)
  Scanner.scan(path)
end
scanner() { |s| ... } click to toggle source
# File lib/ddr/antivirus.rb, line 24
def scanner
  s = Scanner.new
  block_given? ? yield(s) : s
end
test_mode!() click to toggle source
# File lib/ddr/antivirus.rb, line 29
def test_mode!
  configure do |config|
    config.logger = Logger.new(File::NULL)
    config.scanner_adapter = :null
  end
end