Sha256: 70b6c40ca5a2ffbbd6cfc66818e680d56ac8c67266ab6556f66cb2b2634518c8
Contents?: true
Size: 854 Bytes
Versions: 1
Compression:
Stored size: 854 Bytes
Contents
# frozen_string_literal: true require 'xezat' require 'xezat/ext/string' module Xezat class DetectorManager def initialize(detector_dir = File.expand_path(File.join(File.dirname(__FILE__), 'detector'))) Xezat.logger.debug('Load detectors') @detectors = {} Dir.glob(File.join(detector_dir, '*.rb')) do |rb| require rb @detectors[File.basename(rb, '.rb').intern] = Object.const_get("Xezat::Detector::#{File.basename(rb, '.rb').camelize}").new end end def detect(variables) Xezat.logger.debug('Detect tools') tools = [] @detectors.each do |name, detector| if detector.detect(variables) tools << name Xezat.logger.debug(" #{name} ... yes") else Xezat.logger.debug(" #{name} ... no") end end tools end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
xezat-0.1.2 | lib/xezat/detectors.rb |