Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Prism::InspectVisitor#visit_rescue_node
visit_rescue_node(node)
lib/prism/inspect_visitor.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/prism/inspect_visitor.rb, line 2035
def visit_rescue_node(node)
commands << [inspect_node("RescueNode", node), indent]
flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
commands << ["├── exceptions: (length: #{(exceptions = node.exceptions).length})\n", indent]
if exceptions.any?
exceptions[0...-1].each do |child|
commands << [Replace.new("#{indent}│ ├── "), indent]
commands << [child, "#{indent}│ │ "]
end
commands << [Replace.new("#{indent}│ └── "), indent]
commands << [exceptions[-1], "#{indent}│ "]
end
commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
if (reference = node.reference).nil?
commands << ["├── reference: ∅\n", indent]
else
commands << ["├── reference:\n", indent]
commands << [reference, "#{indent}│ "]
end
if (statements = node.statements).nil?
commands << ["├── statements: ∅\n", indent]
else
commands << ["├── statements:\n", indent]
commands << [statements, "#{indent}│ "]
end
if (subsequent = node.subsequent).nil?
commands << ["└── subsequent: ∅\n", indent]
else
commands << ["└── subsequent:\n", indent]
commands << [subsequent, "#{indent} "]
end
end
Inspect a RescueNode node.