Class: Prism::InlineComment
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Comment
|
|
|
Instance Chain:
self,
Comment
|
|
| Inherits: |
Prism::Comment
|
| Defined in: | lib/prism/parse_result.rb |
Overview
InlineComment objects are the most common. They correspond to comments in the source file like this one that start with #.
Class Method Summary
Instance Attribute Summary
-
#trailing? ⇒ Boolean
readonly
Returns true if this comment happens on the same line as other code and false if the comment is by itself.
Comment - Inherited
| #location | The location of this comment in the source. |
Instance Method Summary
-
#inspect
Returns a string representation of this comment.
Comment - Inherited
| #deconstruct_keys | Implement the hash pattern matching interface for |
Constructor Details
This class inherits a constructor from Prism::Comment
Instance Attribute Details
#trailing? ⇒ Boolean (readonly)
Returns true if this comment happens on the same line as other code and false if the comment is by itself.
# File 'lib/prism/parse_result.rb', line 248
def trailing? !location.start_line_slice.strip.empty? end
Instance Method Details
#inspect
Returns a string representation of this comment.
# File 'lib/prism/parse_result.rb', line 253
def inspect "#<Prism::InlineComment @location=#{location.inspect}>" end