Class
This represents a node in the tree. It is the parent class of all of the various node types.
Attributes
Instance Methods
lib/prism/node.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/prism/node.rb, line 35
def pretty_print(q)
q.seplist(inspect.chomp.each_line, -> { q.breakable }) do |line|
q.text(line.chomp)
end
q.current_group.break
end
Similar to inspect, but respects the current level of indentation given by the pretty print object.
#
lib/prism/node.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/prism/node.rb, line 29
def slice
location.slice
end
Slice the location of the node from the source.
#
lib/prism/node.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/prism/node.rb, line 43
def to_dot
DotVisitor.new.tap { |visitor| accept(visitor) }.to_dot
end
Convert this node into a graphviz dot graph string.