instance method
Prism::InspectVisitor#visit_array_node
visit_array_node(node)
lib/prism/inspect_visitor.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/inspect_visitor.rb, line 144
def visit_array_node(node)
commands << [inspect_node("ArrayNode", node), indent]
flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("contains_splat" if node.contains_splat?)].compact
commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
commands << ["├── elements: (length: #{(elements = node.elements).length})\n", indent]
if elements.any?
elements[0...-1].each do |child|
commands << [Replace.new("#{indent}│ ├── "), indent]
commands << [child, "#{indent}│ │ "]
end
commands << [Replace.new("#{indent}│ └── "), indent]
commands << [elements[-1], "#{indent}│ "]
end
commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent]
end
Inspect a ArrayNode node.
See also
#visit_arguments_node
#visit_array_pattern_node
#visit_and_node
#visit_assoc_node
also in
3.4