class Prism::Comment
This represents a comment that was encountered during parsing. It is the base class for all comment types.
This represents a comment that was encountered during parsing. It is the base class for all comment types.
Attributes
Location
Public Class Methods
(Location location) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/parse_result.rb, line 718 def initialize(location) @location = location end
Create a new comment object with the given location.
Create a new comment object with the given location.
: (Location location) -> void
Public Instance Methods
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/parse_result.rbs, line 503
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/parse_result.rb, line 732 def slice location.slice end
Returns the content of the comment by slicing it from the source code.
Returns the content of the comment by slicing it from the source code.
: () -> String
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/parse_result.rb, line 741 def trailing? raise NotImplementedError, "trailing? is not implemented for #{self.class}" end
Returns true if this comment happens on the same line as other code and false if the comment is by itself. This can only be true for inline comments and should be false for block comments.
Returns true if this comment happens on the same line as other code and false if the comment is by itself. This can only be true for inline comments and should be false for block comments.
: () -> bool