Class: Prism::Merge::NocovNode::LocationWithOffsets
- Inherits:
-
Struct
- Object
- Struct
- Prism::Merge::NocovNode::LocationWithOffsets
- Defined in:
- lib/prism/merge/nocov_node.rb
Overview
Location struct with byte offsets for correct range comparison with Prism nodes. start_offset / end_offset are used by TopLevelMergeRunner#node_offset_range and must be byte offsets (not line numbers) to avoid false "already output" matches against FreezeNode ranges that also use byte offsets.
Also exposes leading_comments delegated from the owning NocovNode so that filtered_leading_comments_for / emit_dest_gap_lines can find comments that appear in the file before the opening # :nocov: marker.
Instance Attribute Summary collapse
-
#end_line ⇒ Object
Returns the value of attribute end_line.
-
#end_offset ⇒ Object
Returns the value of attribute end_offset.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#start_line ⇒ Object
Returns the value of attribute start_line.
-
#start_offset ⇒ Object
Returns the value of attribute start_offset.
Instance Method Summary collapse
Instance Attribute Details
#end_line ⇒ Object
Returns the value of attribute end_line
32 33 34 |
# File 'lib/prism/merge/nocov_node.rb', line 32 def end_line @end_line end |
#end_offset ⇒ Object
Returns the value of attribute end_offset
32 33 34 |
# File 'lib/prism/merge/nocov_node.rb', line 32 def end_offset @end_offset end |
#owner ⇒ Object
Returns the value of attribute owner
32 33 34 |
# File 'lib/prism/merge/nocov_node.rb', line 32 def owner @owner end |
#start_line ⇒ Object
Returns the value of attribute start_line
32 33 34 |
# File 'lib/prism/merge/nocov_node.rb', line 32 def start_line @start_line end |
#start_offset ⇒ Object
Returns the value of attribute start_offset
32 33 34 |
# File 'lib/prism/merge/nocov_node.rb', line 32 def start_offset @start_offset end |
Instance Method Details
#cover?(line) ⇒ Boolean
33 34 35 |
# File 'lib/prism/merge/nocov_node.rb', line 33 def cover?(line) (start_line..end_line).cover?(line) end |
#leading_comments ⇒ Object
37 38 39 |
# File 'lib/prism/merge/nocov_node.rb', line 37 def leading_comments owner.leading_comments end |