Class: Prism::Comment

Inherits:
Object show all
Defined in:
lib/prism/parse_result.rb

Overview

This represents a comment that was encountered during parsing. It is the base class for all comment types.

Direct Known Subclasses

EmbDocComment, InlineComment

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ Comment

Create a new comment object with the given location.



233
234
235
# File 'lib/prism/parse_result.rb', line 233

def initialize(location)
  @location = location
end

Instance Attribute Details

#locationObject (readonly)

The location of this comment in the source.



230
231
232
# File 'lib/prism/parse_result.rb', line 230

def location
  @location
end

Instance Method Details

#deconstruct_keys(keys) ⇒ Object

Implement the hash pattern matching interface for Comment.



238
239
240
# File 'lib/prism/parse_result.rb', line 238

def deconstruct_keys(keys)
  { location: location }
end