Class: Covered::Policy

Inherits:
Wrapper show all
Defined in:
lib/covered/policy.rb

Instance Attribute Summary collapse

Attributes inherited from Wrapper

#output

Instance Method Summary collapse

Methods inherited from Wrapper

#each, #mark, #to_h

Constructor Details

#initializePolicy

Returns a new instance of Policy.



38
39
40
41
42
43
# File 'lib/covered/policy.rb', line 38

def initialize
	super(Files.new)
	
	@threshold = 1.0
	@summary_class = PartialSummary
end

Instance Attribute Details

#summary_classObject

Returns the value of attribute summary_class.



45
46
47
# File 'lib/covered/policy.rb', line 45

def summary_class
  @summary_class
end

#thresholdObject

Returns the value of attribute threshold.



46
47
48
# File 'lib/covered/policy.rb', line 46

def threshold
  @threshold
end

Instance Method Details

#cache!Object



77
78
79
# File 'lib/covered/policy.rb', line 77

def cache!
	@output = Cache.new(@output)
end

#captureObject



81
82
83
# File 'lib/covered/policy.rb', line 81

def capture
	@capture ||= Capture.new(@output)
end

#disableObject



89
90
91
# File 'lib/covered/policy.rb', line 89

def disable
	capture.disable
end

#enableObject



85
86
87
# File 'lib/covered/policy.rb', line 85

def enable
	capture.enable
end

#freezeObject



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

def freeze
	return if frozen?
	
	capture
	summary(threshold: @threshold)
	
	super
end

#include(*args) ⇒ Object



61
62
63
# File 'lib/covered/policy.rb', line 61

def include(*args)
	@output = Include.new(@output, *args)
end

#only(*args) ⇒ Object



69
70
71
# File 'lib/covered/policy.rb', line 69

def only(*args)
	@output = Only.new(@output, *args)
end


97
98
99
# File 'lib/covered/policy.rb', line 97

def print_summary(*args)
	summary.print_summary(*args)
end

#root(*args) ⇒ Object



73
74
75
# File 'lib/covered/policy.rb', line 73

def root(*args)
	@output = Root.new(@output, *args)
end

#skip(*args) ⇒ Object



65
66
67
# File 'lib/covered/policy.rb', line 65

def skip(*args)
	@output = Skip.new(@output, *args)
end

#source(*args) ⇒ Object



57
58
59
# File 'lib/covered/policy.rb', line 57

def source(*args)
	@output = Source.new(@output, *args)
end

#summary(*args) ⇒ Object



93
94
95
# File 'lib/covered/policy.rb', line 93

def summary(*args)
	@summary ||= @summary_class.new(@output, *args)
end