class Prism::Comment

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

Attributes

location[R]

The location of this comment in the source.

Public Class Methods

new(location) click to toggle source

Create a new comment object with the given location.

# File lib/prism/parse_result.rb, line 308
def initialize(location)
  @location = location
end

Public Instance Methods

deconstruct_keys(keys) click to toggle source

Implement the hash pattern matching interface for Comment.

# File lib/prism/parse_result.rb, line 313
def deconstruct_keys(keys)
  { location: location }
end
slice() click to toggle source

Returns the content of the comment by slicing it from the source code.

# File lib/prism/parse_result.rb, line 318
def slice
  location.slice
end