Sha256: 82ce1d16b07c81233132b1ae34431636cc4ca9ddd366043525460bb876aca389
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true require 'terminal-table' require_relative '../logger' # Export Code into Screen module CodeDisplayer def self.show(codes) return if codes.nil? || codes.size.zero? total_c = total_q = total_e = 0 my_screen_table = Terminal::Table.new do |st| st << %w[Filename Type Questions Lines xFactor] st << :separator end codes.each do |code| next unless code.process? e = code.lines.size q = code.questions.size factor = 'Unkown' factor = (q.to_f / e).round(2).to_s unless e.zero? my_screen_table.add_row [Rainbow(File.basename(code.filename)).green, code.type, q, e, factor] total_c += 1 total_q += q total_e += e end my_screen_table.add_separator my_screen_table.add_row [Rainbow("TOTAL = #{total_c}").bright, ' ', Rainbow(total_q.to_s).bright, Rainbow(total_e.to_s).bright, Rainbow((total_q / total_e.to_f).round(2)).bright] return unless total_c.positive? Logger.verboseln "\n[INFO] Showing CODE statistics" Logger.verboseln my_screen_table.to_s end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
asker-tool-2.1.7 | lib/asker/displayer/code_displayer.rb |
asker-tool-2.1.6 | lib/asker/displayer/code_displayer.rb |
asker-tool-2.1.5 | lib/asker/displayer/code_displayer.rb |