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
#each, #expand_path, #mark, #relative_path, #to_h
Constructor Details
#initialize ⇒ Policy
Returns a new instance of Policy.
38
39
40
41
42
|
# File 'lib/covered/policy.rb', line 38
def initialize
super(Files.new)
@reports = []
end
|
Instance Attribute Details
#reports ⇒ Object
Returns the value of attribute reports.
89
90
91
|
# File 'lib/covered/policy.rb', line 89
def reports
@reports
end
|
Instance Method Details
#cache! ⇒ Object
73
74
75
|
# File 'lib/covered/policy.rb', line 73
def cache!
@output = Cache.new(@output)
end
|
#call(*args) ⇒ Object
134
135
136
137
138
|
# File 'lib/covered/policy.rb', line 134
def call(*args)
@reports.each do |report|
report.call(self, *args)
end
end
|
#capture ⇒ Object
77
78
79
|
# File 'lib/covered/policy.rb', line 77
def capture
@capture ||= Capture.new(@output)
end
|
#disable ⇒ Object
85
86
87
|
# File 'lib/covered/policy.rb', line 85
def disable
capture.disable
end
|
#enable ⇒ Object
81
82
83
|
# File 'lib/covered/policy.rb', line 81
def enable
capture.enable
end
|
#freeze ⇒ Object
44
45
46
47
48
49
50
51
|
# File 'lib/covered/policy.rb', line 44
def freeze
return self if frozen?
capture
@reports.freeze
super
end
|
#include(*args) ⇒ Object
57
58
59
|
# File 'lib/covered/policy.rb', line 57
def include(*args)
@output = Include.new(@output, *args)
end
|
#only(*args) ⇒ Object
65
66
67
|
# File 'lib/covered/policy.rb', line 65
def only(*args)
@output = Only.new(@output, *args)
end
|
#reports!(coverage = ) ⇒ Object
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# File 'lib/covered/policy.rb', line 117
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
69
70
71
|
# File 'lib/covered/policy.rb', line 69
def root(*args)
@output = Root.new(@output, *args)
end
|
#skip(*args) ⇒ Object
61
62
63
|
# File 'lib/covered/policy.rb', line 61
def skip(*args)
@output = Skip.new(@output, *args)
end
|
#source(*args) ⇒ Object
53
54
55
|
# File 'lib/covered/policy.rb', line 53
def source(*args)
@output = Source.new(@output, *args)
end
|