Class: DeepCover::FlagCommentAssociator
- Inherits:
-
Object
- Object
- DeepCover::FlagCommentAssociator
- Defined in:
- lib/deep_cover/flag_comment_associator.rb
Overview
A processor which computes which lines to be considered flagged with the given lookup
Instance Method Summary collapse
- #include?(range) ⇒ Boolean
-
#initialize(covered_code, lookup = 'nocov') ⇒ FlagCommentAssociator
constructor
A new instance of FlagCommentAssociator.
- #ranges ⇒ Object
Constructor Details
#initialize(covered_code, lookup = 'nocov') ⇒ FlagCommentAssociator
Returns a new instance of FlagCommentAssociator.
12 13 14 15 16 |
# File 'lib/deep_cover/flag_comment_associator.rb', line 12 def initialize(covered_code, lookup = 'nocov') @covered_code = covered_code @lookup = /^#[\s#*-]*#{lookup}[\s#*-]*$/ @ranges = nil end |
Instance Method Details
#include?(range) ⇒ Boolean
18 19 20 21 22 |
# File 'lib/deep_cover/flag_comment_associator.rb', line 18 def include?(range) return false unless (exp = range.expression) lineno = exp.line ranges.any? { |r| r.cover? lineno } end |
#ranges ⇒ Object
24 25 26 |
# File 'lib/deep_cover/flag_comment_associator.rb', line 24 def ranges @ranges ||= compute_ranges end |