Sha256: a3be142b487cf9731ce302c70e87015d55326e70a4076db69b8ebc5d7b171359
Contents?: true
Size: 894 Bytes
Versions: 3
Compression:
Stored size: 894 Bytes
Contents
require_relative 'analyzer' require_relative 'calculator' module SandiMeter class FileScanner def initialize(log_errors = false) @log_errors = log_errors @calculator = SandiMeter::Calculator.new end def scan(path, store_details = false) if File.directory?(path) scan_dir(path) else scan_file(path) end @calculator.calculate!(store_details) end private def scan_dir(path) Dir["#{path}/**/*.rb"].each do |file| scan_file(file) end end def scan_file(path) begin analyzer = SandiMeter::Analyzer.new data = analyzer.analyze(path) @calculator.push(data) rescue Exception => e if @log_errors # TODO # add backtrace puts "Checkout #{path} for:" puts "\t#{e.message}" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sandi_meter-1.0.2 | lib/sandi_meter/file_scanner.rb |
sandi_meter-1.0.1 | lib/sandi_meter/file_scanner.rb |
sandi_meter-1.0.0 | lib/sandi_meter/file_scanner.rb |