Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
PrettyPrint#break_outmost_groups
break_outmost_groups
lib/prettyprint.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/lib/prettyprint.rb, line 162
def break_outmost_groups
while @maxwidth < @output_width + @buffer_width
return unless group = @group_queue.deq
until group.breakables.empty?
data = @buffer.shift
@output_width = data.output(@output, @output_width)
@buffer_width -= data.width
end
while !@buffer.empty? && Text === @buffer.first
text = @buffer.shift
@output_width = text.output(@output, @output_width)
@buffer_width -= text.width
end
end
end
Breaks the buffer into lines that are shorter than maxwidth
See also
#breakable
#current_group
.singleline_format
#fill_breakable
also in
4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0