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
#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.end_offset end
#leading_comment(comment)
[ GitHub ]# File 'lib/prism/parse_result/comments.rb', line 42
def leading_comment(comment) node.location.leading_comment(comment) end
#start_offset
[ GitHub ]# File 'lib/prism/parse_result/comments.rb', line 29
def start_offset node.start_offset end
#trailing_comment(comment)
[ GitHub ]# File 'lib/prism/parse_result/comments.rb', line 46
def trailing_comment(comment) node.location.trailing_comment(comment) end