module Ratonvirus
Binding it to rails to make the app and config folders available in the Rails load paths.
Constants
- VERSION
Public Class Methods
add_addon(addon)
click to toggle source
# 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
addons()
click to toggle source
# File lib/ratonvirus.rb, line 76 def self.addons @addons end
addons=(addons)
click to toggle source
# File lib/ratonvirus.rb, line 80 def self.addons=(addons) @addons = [] addons.each do |addon| add_addon addon end end
configure() { |self| ... }
click to toggle source
Usage:
Ratonvirus.configure do |config| config.scanner = :eicar config.storage = :active_storage config.addons = [:remove_infected] end
# File lib/ratonvirus.rb, line 33 def self.configure yield self end
remove_addon(addon)
click to toggle source
# File lib/ratonvirus.rb, line 92 def self.remove_addon(addon) addon_cls = addon_class(addon) @addons.delete(addon_cls) end
reset()
click to toggle source
Resets Ratonvirus
to its initial state and configuration
# File lib/ratonvirus.rb, line 64 def self.reset # Default addons @addons = [ ActiveSupport::Inflector.constantize( "#{name}::Scanner::Addon::RemoveInfected" ) ] destroy_scanner destroy_storage end
Private Class Methods
addon_class(type)
click to toggle source
private
# File lib/ratonvirus.rb, line 98 def self.addon_class(type) return type if type.is_a?(Class) subclass = ActiveSupport::Inflector.camelize(type.to_s) ActiveSupport::Inflector.constantize( "#{name}::Scanner::Addon::#{subclass}" ) end