Module: Ratonvirus

Extended by:
Support::Backend
Defined in:
lib/ratonvirus/engine.rb,
lib/ratonvirus.rb,
lib/ratonvirus/error.rb,
lib/ratonvirus/version.rb,
lib/ratonvirus/processable.rb,
lib/ratonvirus/scanner/base.rb,
lib/ratonvirus/storage/base.rb,
lib/ratonvirus/scanner/eicar.rb,
lib/ratonvirus/storage/multi.rb,
lib/ratonvirus/support/backend.rb,
lib/ratonvirus/storage/filepath.rb,
lib/ratonvirus/storage/carrierwave.rb,
lib/ratonvirus/storage/active_storage.rb,
lib/ratonvirus/scanner/support/callbacks.rb,
lib/ratonvirus/storage/support/io_handling.rb,
lib/ratonvirus/scanner/addon/remove_infected.rb

Overview

Binding it to rails to make the app and config folders available in the Rails load paths.

Defined Under Namespace

Modules: Scanner, Storage, Support Classes: Engine, Error, InvalidError, NotDefinedError, NotImplementedError, Processable

Constant Summary collapse

VERSION =
"0.4.2"

Class Method Summary collapse

Methods included from Support::Backend

backend_class

Class Method Details

.add_addon(addon) ⇒ Object



87
88
89
90
# File 'lib/ratonvirus.rb', line 87

def self.add_addon(addon)
  addon_cls = addon_class(addon)
  @addons << addon_cls unless @addons.include?(addon_cls)
end

.addonsObject



76
77
78
# File 'lib/ratonvirus.rb', line 76

def self.addons
  @addons
end

.addons=(addons) ⇒ Object



80
81
82
83
84
85
# File 'lib/ratonvirus.rb', line 80

def self.addons=(addons)
  @addons = []
  addons.each do |addon|
    add_addon addon
  end
end

.configure {|_self| ... } ⇒ Object

Usage:

Ratonvirus.configure do |config|
  config.scanner = :eicar
  config.storage = :active_storage
  config.addons  = [:remove_infected]
end

Yields:

  • (_self)

Yield Parameters:

  • _self (Ratonvirus)

    the object that the method was called on



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

def self.configure
  yield self
end

.remove_addon(addon) ⇒ Object



92
93
94
95
# File 'lib/ratonvirus.rb', line 92

def self.remove_addon(addon)
  addon_cls = addon_class(addon)
  @addons.delete(addon_cls)
end

.resetObject

Resets Ratonvirus to its initial state and configuration



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ratonvirus.rb', line 64

def self.reset
  # Default addons
  @addons = [
    ActiveSupport::Inflector.constantize(
      "#{name}::Scanner::Addon::RemoveInfected"
    )
  ]

  destroy_scanner
  destroy_storage
end