Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Prism::InspectVisitor#compose
compose
lib/prism/inspect_visitor.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/prism/inspect_visitor.rb, line 48
def compose
buffer = +""
replace = nil
until commands.empty?
# @type var command: String | node | Replace
# @type var indent: String
command, indent = *commands.shift
case command
when String
buffer << (replace || indent)
buffer << command
replace = nil
when Node
visitor = InspectVisitor.new(indent)
command.accept(visitor)
@commands = [*visitor.commands, *@commands]
when Replace
replace = command.value
else
raise "Unknown command: #{command.inspect}"
end
end
buffer
end
Compose the final string.