instance method
Prism::InspectVisitor#visit_begin_node
visit_begin_node(node)
lib/prism/inspect_visitor.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/inspect_visitor.rb, line 235
def visit_begin_node(node)
commands << [inspect_node("BeginNode", node), indent]
flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
commands << ["├── begin_keyword_loc: #{inspect_location(node.begin_keyword_loc)}\n", indent]
if (statements = node.statements).nil?
commands << ["├── statements: ∅\n", indent]
else
commands << ["├── statements:\n", indent]
commands << [statements, "#{indent}│ "]
end
if (rescue_clause = node.rescue_clause).nil?
commands << ["├── rescue_clause: ∅\n", indent]
else
commands << ["├── rescue_clause:\n", indent]
commands << [rescue_clause, "#{indent}│ "]
end
if (else_clause = node.else_clause).nil?
commands << ["├── else_clause: ∅\n", indent]
else
commands << ["├── else_clause:\n", indent]
commands << [else_clause, "#{indent}│ "]
end
if (ensure_clause = node.ensure_clause).nil?
commands << ["├── ensure_clause: ∅\n", indent]
else
commands << ["├── ensure_clause:\n", indent]
commands << [ensure_clause, "#{indent}│ "]
end
commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent]
end
Inspect a BeginNode node.