Skip to content

Commit

Permalink
Merge pull request #25 from prawnpdf/hb_issue_20
Browse files Browse the repository at this point in the history
fixes #20 - empty rows may have resulted in an error
  • Loading branch information
hbrandl committed Sep 16, 2014
2 parents b75bcc9 + d3d642e commit 530c34c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions lib/prawn/table/cells.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ def columns(col_spec)
class Cells < Array

def fits_on_current_page?(offset, ref_bounds)
# an empty row array means it definitely fits
return true if self.empty?

height_with_span < (self[0,0].y + offset) - ref_bounds.absolute_bottom
end

Expand Down
5 changes: 2 additions & 3 deletions spec/table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@
t.cells[2, 3].content.should == "i"
end

it 'illustrates issue #20', :unresolved, issue: 20 do
it 'illustrates issue #20', issue: 20 do
pdf = Prawn::Document.new
description = "one\ntwo\nthree"
bullets = description.split("\n")
Expand All @@ -1589,8 +1589,7 @@
else
rows << [ { content: bullet, width: 440, padding_top: 0, align: :justify } ]
end

pdf.table(rows, header: true, width: 465, cell_style: { border_width: 0, inline_format: true })
pdf.table(rows, header: true, cell_style: { border_width: 0, inline_format: true })
end
pdf.render
end
Expand Down

0 comments on commit 530c34c

Please sign in to comment.