Skip to content

Commit

Permalink
Allow setting a cell's min_width and max_width properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ericfreese committed Jun 15, 2016
1 parent da04233 commit 6f5660c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/prawn/table/cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:
# <tt>[:left, :right, :top, :bottom]</tt>.
#
Expand Down
3 changes: 2 additions & 1 deletion lib/prawn/table/cell/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6f5660c

Please sign in to comment.