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, prism/extension.c |
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 |
#slice | Returns the content of the comment by slicing it from the source code. |
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 532
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 537
def inspect "#<Prism::InlineComment @location=#{location.inspect}>" end