lib/prawn/text/formatted/wrap.rb in prawn-2.2.2 vs lib/prawn/text/formatted/wrap.rb in prawn-2.3.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
# wrap.rb: Handles text wrapping for for formatted text
#
# Contributed by Daniel Nelson
#
# This is free software. Please see the LICENSE and COPYING files for details.
@@ -101,15 +103,15 @@
)
accumulated_width += fragment_this_line.width
end
@printed_lines << printed_fragments.map do |s|
- s.force_encoding(::Encoding::UTF_8)
+ s.dup.force_encoding(::Encoding::UTF_8)
end.join
end
def word_spacing_for_this_line
- if @align == :justify && @line_wrap.space_count > 0 &&
+ if @align == :justify && @line_wrap.space_count.positive? &&
!@line_wrap.paragraph_finished?
(available_width - @line_wrap.width) / @line_wrap.space_count
else
0
end