class YARP::Comment

This represents a comment that was encountered during parsing.

Constants

TYPES

Attributes

location[R]
type[R]

Public Class Methods

new(type, location) click to toggle source
# File yarp.rb, line 150
def initialize(type, location)
  @type = type
  @location = location
end

Public Instance Methods

deconstruct_keys(keys) click to toggle source
# File yarp.rb, line 155
def deconstruct_keys(keys)
  { type: type, location: location }
end
inspect() click to toggle source
# File yarp.rb, line 164
def inspect
  "#<YARP::Comment @type=#{@type.inspect} @location=#{@location.inspect}>"
end
trailing?() click to toggle source

Returns true if the comment happens on the same line as other code and false if the comment is by itself

# File yarp.rb, line 160
def trailing?
  type == :inline && !location.start_line_slice.strip.empty?
end