class Sqreen::Ecosystem::ModuleRegistry
Public Class Methods
new()
click to toggle source
# File lib/sqreen/ecosystem/module_registry.rb, line 13 def initialize @mods = [] end
Public Instance Methods
destroy_all()
click to toggle source
# File lib/sqreen/ecosystem/module_registry.rb, line 34 def destroy_all # not implemented end
each_module(type = nil, &block)
click to toggle source
@param [Class] type
# File lib/sqreen/ecosystem/module_registry.rb, line 39 def each_module(type = nil, &block) selected_mods = type ? (@mods.select { |mod| mod.is_a?(type) }) : @mods if block_given? selected_mods.each(&block) else selected_mods.each end end
init_all()
click to toggle source
# File lib/sqreen/ecosystem/module_registry.rb, line 21 def init_all logger.info { "Initializing #{@mods.size} ecosystem modules" } each_module do |mod| unless mod.respond_to? :setup logger.debug { "Module with type #{mod.class} requires no initialization" } next end logger.debug { "Initializing module with type #{mod.class}" } mod.setup end end
module_subset(type)
click to toggle source
# File lib/sqreen/ecosystem/module_registry.rb, line 48 def module_subset(type) each_module(type).to_a end
register(mod)
click to toggle source
# File lib/sqreen/ecosystem/module_registry.rb, line 17 def register(mod) @mods << mod end