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