class YARP::ParseResult::Comments::NodeTarget

A target for attaching comments that is based on a specific node’s location.

Attributes

node[R]

Public Class Methods

new(node) click to toggle source
# File yarp/parse_result/comments.rb, line 25
def initialize(node)
  @node = node
end

Public Instance Methods

<<(comment) click to toggle source
# File yarp/parse_result/comments.rb, line 42
def <<(comment)
  node.location.comments << comment
end
encloses?(comment) click to toggle source
# File yarp/parse_result/comments.rb, line 37
def encloses?(comment)
  start_offset <= comment.location.start_offset &&
    comment.location.end_offset <= end_offset
end
end_offset() click to toggle source
# File yarp/parse_result/comments.rb, line 33
def end_offset
  node.location.end_offset
end
start_offset() click to toggle source
# File yarp/parse_result/comments.rb, line 29
def start_offset
  node.location.start_offset
end