Class: Prism::ParseResult::Comments::LocationTarget
- Inherits:
-
Object
- Object
- Prism::ParseResult::Comments::LocationTarget
- Defined in:
- lib/prism/parse_result/comments.rb
Overview
A target for attaching comments that is based on a location field on a node. For example, the ‘end` token of a ClassNode.
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
- #encloses?(comment) ⇒ Boolean
- #end_offset ⇒ Object
-
#initialize(location) ⇒ LocationTarget
constructor
A new instance of LocationTarget.
- #leading_comment(comment) ⇒ Object
- #start_offset ⇒ Object
- #trailing_comment(comment) ⇒ Object
Constructor Details
permalink #initialize(location) ⇒ LocationTarget
Returns a new instance of LocationTarget.
56 57 58 |
# File 'lib/prism/parse_result/comments.rb', line 56 def initialize(location) @location = location end |
Instance Attribute Details
permalink #location ⇒ Object (readonly)
:nodoc:
54 55 56 |
# File 'lib/prism/parse_result/comments.rb', line 54 def location @location end |
Instance Method Details
permalink #encloses?(comment) ⇒ Boolean
68 69 70 |
# File 'lib/prism/parse_result/comments.rb', line 68 def encloses?(comment) false end |
permalink #end_offset ⇒ Object
[View source]
64 65 66 |
# File 'lib/prism/parse_result/comments.rb', line 64 def end_offset location.end_offset end |
permalink #leading_comment(comment) ⇒ Object
[View source]
72 73 74 |
# File 'lib/prism/parse_result/comments.rb', line 72 def leading_comment(comment) location.leading_comment(comment) end |
permalink #start_offset ⇒ Object
[View source]
60 61 62 |
# File 'lib/prism/parse_result/comments.rb', line 60 def start_offset location.start_offset end |
permalink #trailing_comment(comment) ⇒ Object
[View source]
76 77 78 |
# File 'lib/prism/parse_result/comments.rb', line 76 def trailing_comment(comment) location.trailing_comment(comment) end |