From 6f5660cc0419dd8f9ee5c97882be0dd79680e23d Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Tue, 14 Jun 2016 15:00:31 -0600 Subject: [PATCH] Allow setting a cell's `min_width` and `max_width` properties --- lib/prawn/table/cell.rb | 8 ++++++++ lib/prawn/table/cell/text.rb | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/prawn/table/cell.rb b/lib/prawn/table/cell.rb index 83b940f..8025b2d 100644 --- a/lib/prawn/table/cell.rb +++ b/lib/prawn/table/cell.rb @@ -112,6 +112,14 @@ def max_width # attr_writer :height + # Manually specify the cell's min_width + # + attr_writer :min_width + + # Manually specify the cell's max_width + # + attr_writer :max_width + # Specifies which borders to enable. Must be an array of zero or more of: # [:left, :right, :top, :bottom]. # diff --git a/lib/prawn/table/cell/text.rb b/lib/prawn/table/cell/text.rb index ff28789..48ebbf7 100644 --- a/lib/prawn/table/cell/text.rb +++ b/lib/prawn/table/cell/text.rb @@ -82,8 +82,9 @@ def set_width_constraints unless defined?(@min_width) && @min_width min_content_width = [natural_content_width, styled_width_of_single_character].min @min_width = padding_left + padding_right + min_content_width - super end + + super end protected