Class: Covered::Policy
Defined Under Namespace
Classes: Autoload
Instance Attribute Summary collapse
Attributes inherited from Wrapper
#output
Instance Method Summary
collapse
Methods inherited from Wrapper
#accept?, #each, #expand_path, #mark, #relative_path, #to_h
Methods inherited from Base
#accept?, #each, #expand_path, #mark, #relative_path
Constructor Details
#initialize ⇒ Policy
Returns a new instance of Policy.
39
40
41
42
43
|
# File 'lib/covered/policy.rb', line 39
def initialize
super(Files.new)
@reports = []
end
|
Instance Attribute Details
#reports ⇒ Object
Returns the value of attribute reports
94
95
96
|
# File 'lib/covered/policy.rb', line 94
def reports
@reports
end
|
Instance Method Details
#cache! ⇒ Object
74
75
76
|
# File 'lib/covered/policy.rb', line 74
def cache!
@output = Cache.new(@output)
end
|
#call(*args) ⇒ Object
139
140
141
142
143
|
# File 'lib/covered/policy.rb', line 139
def call(*args)
@reports.each do |report|
report.call(self, *args)
end
end
|
#capture ⇒ Object
82
83
84
|
# File 'lib/covered/policy.rb', line 82
def capture
@capture ||= Capture.new(@output)
end
|
#disable ⇒ Object
90
91
92
|
# File 'lib/covered/policy.rb', line 90
def disable
capture.disable
end
|
#enable ⇒ Object
86
87
88
|
# File 'lib/covered/policy.rb', line 86
def enable
capture.enable
end
|
#freeze ⇒ Object
45
46
47
48
49
50
51
52
|
# File 'lib/covered/policy.rb', line 45
def freeze
return self if frozen?
capture
@reports.freeze
super
end
|
#include(*args) ⇒ Object
58
59
60
|
# File 'lib/covered/policy.rb', line 58
def include(*args)
@output = Include.new(@output, *args)
end
|
#only(*args) ⇒ Object
66
67
68
|
# File 'lib/covered/policy.rb', line 66
def only(*args)
@output = Only.new(@output, *args)
end
|
#persist! ⇒ Object
78
79
80
|
# File 'lib/covered/policy.rb', line 78
def persist!
@output = Persist.new(@output)
end
|
#reports!(coverage = ENV['COVERAGE']) ⇒ Object
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
# File 'lib/covered/policy.rb', line 122
def reports!(coverage = ENV['COVERAGE'])
if coverage
names = coverage.split(',')
names.each do |name|
begin
klass = Covered.const_get(name)
@reports << klass.new
rescue NameError
@reports << Autoload.new(name)
end
end
else
@reports << Covered::BriefSummary.new
end
end
|
#root(*args) ⇒ Object
70
71
72
|
# File 'lib/covered/policy.rb', line 70
def root(*args)
@output = Root.new(@output, *args)
end
|
#skip(*args) ⇒ Object
62
63
64
|
# File 'lib/covered/policy.rb', line 62
def skip(*args)
@output = Skip.new(@output, *args)
end
|
#source(*args) ⇒ Object
54
55
56
|
# File 'lib/covered/policy.rb', line 54
def source(*args)
@output = Source.new(@output, *args)
end
|