lib/xezat/detectors.rb in xezat-0.1.0 vs lib/xezat/detectors.rb in xezat-0.1.1
- old
+ new
@@ -1,18 +1,29 @@
+# frozen_string_literal: true
+
+require 'xezat'
+
module Xezat
class DetectorManager
def initialize(detector_dir = File.expand_path(File.join(File.dirname(__FILE__), 'detector')))
+ LOG.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::#{Xezat::Detector.constants[-1]}").new
end
end
def detect(variables)
+ LOG.debug('Detect tools')
tools = []
@detectors.each do |name, detector|
- tools << name if detector.detect(variables)
+ if detector.detect(variables)
+ tools << name
+ LOG.debug(" #{name} ... yes")
+ else
+ LOG.debug(" #{name} ... no")
+ end
end
tools
end
end
end