Class: Ratonvirus::Scanner::Clamby

Inherits:
Base
  • Object
show all
Defined in:
lib/ratonvirus/scanner/clamby.rb

Constant Summary collapse

CLAMBY_DEFAULT_CONFIG =
::Clamby::DEFAULT_CONFIG.merge(
  # We want to handle checking locally on initialization, not on every
  # scan.
  check: false,
  # Should be encouraged as it is much faster.
  daemonize: true,
  # We are checking already executable? and therefore not needed.
  error_clamscan_missing: false,
  # We want Ratonvirus to report issues errors on client errors.
  error_clamscan_client_error: true,
  # We want Ratonvirus to report issues on file missing errors.
  error_file_missing: true,
  # No output is required not to fill the logs. The scanning errors
  output_level: 'off',
).freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configure(config = {}) ⇒ Object



23
24
25
# File 'lib/ratonvirus/scanner/clamby.rb', line 23

def configure(config={})
  ::Clamby.configure(config)
end

.executable?Boolean

Avoid multiple calls to the clamscan utility to check whether the system is executable.

Returns:

  • (Boolean)


33
34
35
36
# File 'lib/ratonvirus/scanner/clamby.rb', line 33

def executable?
  # Clamby should return `nil` when clamscan is not available.
  !!::Clamby::Command.clamscan_version
end

.resetObject



27
28
29
# File 'lib/ratonvirus/scanner/clamby.rb', line 27

def reset
  configure(CLAMBY_DEFAULT_CONFIG.dup)
end

Instance Method Details

#setupObject

Allow users to configure Clamby the way they want to.



40
41
42
43
44
# File 'lib/ratonvirus/scanner/clamby.rb', line 40

def setup
  self.class.configure(config[:clamby] || {})

  super
end