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
#initialize(location) ⇒ LocationTarget
Returns a new instance of LocationTarget.
57 58 59 |
# File 'lib/prism/parse_result/comments.rb', line 57 def initialize(location) @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
:nodoc:
55 56 57 |
# File 'lib/prism/parse_result/comments.rb', line 55 def location @location end |
Instance Method Details
#encloses?(comment) ⇒ Boolean
69 70 71 |
# File 'lib/prism/parse_result/comments.rb', line 69 def encloses?(comment) false end |
#end_offset ⇒ Object
65 66 67 |
# File 'lib/prism/parse_result/comments.rb', line 65 def end_offset location.end_offset end |
#leading_comment(comment) ⇒ Object
73 74 75 |
# File 'lib/prism/parse_result/comments.rb', line 73 def leading_comment(comment) location.leading_comment(comment) end |
#start_offset ⇒ Object
61 62 63 |
# File 'lib/prism/parse_result/comments.rb', line 61 def start_offset location.start_offset end |
#trailing_comment(comment) ⇒ Object
77 78 79 |
# File 'lib/prism/parse_result/comments.rb', line 77 def trailing_comment(comment) location.trailing_comment(comment) end |