module Clamby

Constants

DEFAULT_CONFIG
VERSION

Attributes

config[R]
valid_config_keys[R]

Public Class Methods

configure(opts = {}) click to toggle source
# File lib/clamby.rb, line 33
def self.configure(opts = {})
  if opts.delete(:silence_output)
    warn ':silence_output config is deprecated. Use :output_level => "off" instead.'
    opts[:output_level] = 'off'
  end

  opts.each {|k,v| config[k.to_sym] = v if valid_config_keys.include? k.to_sym}
end
daemonize?() click to toggle source
# File lib/clamby.rb, line 67
def self.daemonize?
  !! config[:daemonize]
end
safe?(path) click to toggle source
# File lib/clamby.rb, line 42
def self.safe?(path)
  value = virus?(path)
  return nil if value.nil?
  ! value
end
scanner_exists?() click to toggle source
# File lib/clamby.rb, line 53
def self.scanner_exists?
  return true unless config[:check]
  scanner = Command.clamscan_version

  return true if scanner
  return false unless config[:error_clamscan_missing]

  raise Clamby::ClamscanMissing.new("#{Command.scan_executable} not found. Check your installation and path.")
end
update() click to toggle source
# File lib/clamby.rb, line 63
def self.update
  Command.freshclam
end
virus?(path) click to toggle source
# File lib/clamby.rb, line 48
def self.virus?(path)
  return nil unless scanner_exists?
  Command.scan path
end