lib/prawn/text/formatted/box.rb in prawn-2.3.0 vs lib/prawn/text/formatted/box.rb in prawn-2.4.0

- old
+ new

@@ -220,15 +220,16 @@ @document.font_size(@font_size) do shrink_to_fit(text) if @overflow == :shrink_to_fit process_vertical_alignment(text) @inked = true unless flags[:dry_run] - unprinted_text = if @rotate != 0 && @inked - render_rotated(text) - else - wrap(text) - end + unprinted_text = + if @rotate != 0 && @inked + render_rotated(text) + else + wrap(text) + end @inked = false end end end end @@ -263,15 +264,16 @@ when :center x = @at[0] + @width * 0.5 - line_width * 0.5 when :right x = @at[0] + @width - line_width when :justify - x = if @direction == :ltr - @at[0] - else - @at[0] + @width - line_width - end + x = + if @direction == :ltr + @at[0] + else + @at[0] + @width - line_width + end else raise ArgumentError, 'align must be one of :left, :right, :center or :justify symbols' end @@ -288,17 +290,19 @@ draw_fragment_underlays(fragment) @document.word_spacing(word_spacing) do if @draw_text_callback @draw_text_callback.call( - fragment.text, at: [x, y], - kerning: @kerning + fragment.text, + at: [x, y], + kerning: @kerning ) else @document.draw_text!( - fragment.text, at: [x, y], - kerning: @kerning + fragment.text, + at: [x, y], + kerning: @kerning ) end end draw_fragment_overlays(fragment) @@ -338,10 +342,11 @@ @extensions ||= [] end # @private def self.inherited(base) + super extensions.each { |e| base.extensions << e } end def valid_options PDF::Core::Text::VALID_OPTIONS + %i[ @@ -369,10 +374,10 @@ text end def original_text - @original_array.collect(&:dup) + @original_array.map(&:dup) end def original_text=(formatted_text) @original_array = formatted_text end