Class: Covered::Wrapper

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/covered/wrapper.rb

Direct Known Subclasses

Cache, Capture, Files, Filter, Include, Policy, Source, Statistics

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output = nil) ⇒ Wrapper

Returns a new instance of Wrapper.



25
26
27
# File 'lib/covered/wrapper.rb', line 25

def initialize(output = nil)
	@output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



29
30
31
# File 'lib/covered/wrapper.rb', line 29

def output
  @output
end

Instance Method Details

#disableObject



39
40
41
# File 'lib/covered/wrapper.rb', line 39

def disable
	@output.disable if @output
end

#each {|Coverage| ... } ⇒ Object

Yields:

  • (Coverage)

    the path to the file, and the execution counts.



44
45
46
# File 'lib/covered/wrapper.rb', line 44

def each(&block)
	@output.each(&block) if @output
end

#enableObject



35
36
37
# File 'lib/covered/wrapper.rb', line 35

def enable
	@output.enable if @output
end

#expand_path(path) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/covered/wrapper.rb', line 56

def expand_path(path)
	if @output
		@output.expand_path(path)
	else
		path
	end
end

#mark(*args) ⇒ Object



31
32
33
# File 'lib/covered/wrapper.rb', line 31

def mark(*args)
	@output.mark(*args) if @output
end

#relative_path(path) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/covered/wrapper.rb', line 48

def relative_path(path)
	if @output
		@output.relative_path(path)
	else
		path
	end
end

#to_hObject



64
65
66
# File 'lib/covered/wrapper.rb', line 64

def to_h
	collect{|coverage| [coverage.path, coverage]}.to_h
end