Class: Prism::ParseResult::Comments::NodeTarget
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/prism/parse_result/comments.rb |
Overview
A target for attaching comments that is based on a specific node’s location.
Class Method Summary
- .new(node) ⇒ NodeTarget constructor
Instance Attribute Summary
- #node readonly
Instance Method Summary
Constructor Details
.new(node) ⇒ NodeTarget
Instance Attribute Details
#node (readonly)
[ GitHub ]# File 'lib/prism/parse_result/comments.rb', line 23
attr_reader :node
Instance Method Details
#<<(comment)
[ GitHub ]
#encloses?(comment) ⇒ Boolean
# File 'lib/prism/parse_result/comments.rb', line 37
def encloses?(comment) start_offset <= comment.location.start_offset && comment.location.end_offset <= end_offset end
#end_offset
[ GitHub ]# File 'lib/prism/parse_result/comments.rb', line 33
def end_offset node.location.end_offset end
#start_offset
[ GitHub ]# File 'lib/prism/parse_result/comments.rb', line 29
def start_offset node.location.start_offset end