class XCPerfect::All
All
prints all code coverage information provided by xccov
Constants
- DOWN
- DOWN_ASCII
- STAT_WIDTH
Public Instance Methods
bar_width()
click to toggle source
# File lib/xcperfect/formatters/all.rb, line 8 def bar_width ((@terminal_width - 8) * 0.3) - STAT_WIDTH end
pretty_files(target)
click to toggle source
# File lib/xcperfect/formatters/all.rb, line 38 def pretty_files(target) target['files'].map do |file| name = spaces(4) + pretty_name(file) functions = pretty_functions(file) [name, functions] end.join("\n") end
pretty_format(desirables)
click to toggle source
# File lib/xcperfect/formatters/all.rb, line 46 def pretty_format(desirables) @parser.extract_targets(desirables).map do |target| [pretty_name(target), pretty_files(target)] end.join("\n") end
pretty_functions(file)
click to toggle source
# File lib/xcperfect/formatters/all.rb, line 21 def pretty_functions(file) file['functions'].map do |function| filename = file['name'] signature, covered, total, percentage = @parser.extract_coverage_info(function) line_stats = "#{covered} / #{total}".ljust(STAT_WIDTH) highlighted = Syntax.highlight(filename, signature) delta = highlighted.length - signature.length highlighted = highlighted.ljust(signature_width + delta) texts = spaces(8) + [highlighted, line_stats].join(' ') bar = Bar.create(percentage, bar_width, @colorize, @use_ascii) texts + bar end end
pretty_name(target)
click to toggle source
# File lib/xcperfect/formatters/all.rb, line 16 def pretty_name(target) symbol = yellow(@use_ascii ? DOWN_ASCII : DOWN) [symbol, white(target['name'])].join(' ') end
signature_width()
click to toggle source
# File lib/xcperfect/formatters/all.rb, line 12 def signature_width (@terminal_width - 8) * 0.62 end