Class: 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
- #<<(comment) ⇒ Object
- #encloses?(comment) ⇒ Boolean
- #end_offset ⇒ Object
-
#initialize(location) ⇒ LocationTarget
constructor
A new instance of LocationTarget.
- #start_offset ⇒ Object
Constructor Details
#initialize(location) ⇒ LocationTarget
Returns a new instance of LocationTarget.
52 53 54 |
# File 'lib/prism/parse_result/comments.rb', line 52 def initialize(location) @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
:nodoc:
50 51 52 |
# File 'lib/prism/parse_result/comments.rb', line 50 def location @location end |
Instance Method Details
#<<(comment) ⇒ Object
68 69 70 |
# File 'lib/prism/parse_result/comments.rb', line 68 def <<(comment) location.comments << comment end |
#encloses?(comment) ⇒ Boolean
64 65 66 |
# File 'lib/prism/parse_result/comments.rb', line 64 def encloses?(comment) false end |
#end_offset ⇒ Object
60 61 62 |
# File 'lib/prism/parse_result/comments.rb', line 60 def end_offset location.end_offset end |
#start_offset ⇒ Object
56 57 58 |
# File 'lib/prism/parse_result/comments.rb', line 56 def start_offset location.start_offset end |