Sha256: 31f67326deb4f9ef08f01f885c816af552a6d9b55895b29c6175f95b190c9222

Contents?: true

Size: 768 Bytes

Versions: 12

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2022, by Samuel Williams.

def initialize(context)
	super
	
	require_relative '../../lib/covered'
end

# Debug the coverage of a file. Show which lines should be executable.
#
# @parameter paths [Array(String)] The paths to parse.
# @parameter execute [Boolean] Whether to execute the code.
def parse(paths: [], execute: false)
	files = output = Covered::Files.new
	output = Covered::Source.new(output)
	
	paths.each do |path|
		output.mark(path, 0, 0)
	end
	
	if execute
		capture = Covered::Capture.new(output)
		capture.enable
		paths.each do |path|
			load path
		end
		capture.disable
		
		files.paths = files.paths.slice(*paths)
	end
	
	Covered::Summary.new.call(output, $stderr)
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
covered-0.19.1 bake/covered/debug.rb
covered-0.19.0 bake/covered/debug.rb
covered-0.18.5 bake/covered/debug.rb
covered-0.18.4 bake/covered/debug.rb
covered-0.18.3 bake/covered/debug.rb
covered-0.18.2 bake/covered/debug.rb
covered-0.18.1 bake/covered/debug.rb
covered-0.18.0 bake/covered/debug.rb
covered-0.17.1 bake/covered/debug.rb
covered-0.17.0 bake/covered/debug.rb
covered-0.16.9 bake/covered/debug.rb
covered-0.16.8 bake/covered/debug.rb