Class: SimpleCov::SourceFile::SkipChunks
- Inherits:
-
Object
- Object
- SimpleCov::SourceFile::SkipChunks
- Defined in:
- lib/simplecov/source_file/skip_chunks.rb
Overview
The line ranges excluded from a SourceFile's coverage per criterion. Two
sources contribute: the deprecated nocov block toggle, and the
SimpleCov::Directive block directives, which can be scoped per criterion.
Class Attribute Summary collapse
-
.nocov_warned ⇒ Object
readonly
Returns the value of attribute nocov_warned.
Instance Method Summary collapse
-
#chunks_for(criterion) ⇒ Object
Every criterion honors the deprecated all-criteria nocov chunks plus its own per-criterion directive ranges, methods included: they carry a source range, and nocov has always meant "exclude everything here".
- #directive_chunks ⇒ Object
-
#initialize(filename, src) ⇒ SkipChunks
constructor
A new instance of SkipChunks.
- #nocov_chunks ⇒ Object
Constructor Details
#initialize(filename, src) ⇒ SkipChunks
Returns a new instance of SkipChunks.
14 15 16 17 |
# File 'lib/simplecov/source_file/skip_chunks.rb', line 14 def initialize(filename, src) @filename = filename @src = src end |
Class Attribute Details
.nocov_warned ⇒ Object (readonly)
Returns the value of attribute nocov_warned.
11 12 13 |
# File 'lib/simplecov/source_file/skip_chunks.rb', line 11 def nocov_warned @nocov_warned end |
Instance Method Details
#chunks_for(criterion) ⇒ Object
Every criterion honors the deprecated all-criteria nocov chunks plus its own per-criterion directive ranges, methods included: they carry a source range, and nocov has always meant "exclude everything here". The ranges are 1-based line numbers, so consumers subtract 1 to index into the zero-based lines array.
24 25 26 |
# File 'lib/simplecov/source_file/skip_chunks.rb', line 24 def chunks_for(criterion) nocov_chunks + directive_chunks.fetch(criterion) end |
#directive_chunks ⇒ Object
32 33 34 |
# File 'lib/simplecov/source_file/skip_chunks.rb', line 32 def directive_chunks @directive_chunks ||= Directive.disabled_ranges(ruby_lines) end |
#nocov_chunks ⇒ Object
28 29 30 |
# File 'lib/simplecov/source_file/skip_chunks.rb', line 28 def nocov_chunks @nocov_chunks ||= build_nocov_chunks end |