public
Description: Fast, Nimble PDF Writer for Ruby
Homepage: http://prawn.majesticseacreature.com
Clone URL: git://github.com/sandal/prawn.git
Fix empty string issue on tables.  I might want to investigate how this code 
handles nils.  [#36 state:resolved]
sandal (author)
Wed Jul 16 15:14:13 -0700 2008
commit  63300008ad3cda14c529d356242413f91af68b50
tree    44acc04063061097f99c0ab7778a5b6c7c28318a
parent  cca72f343055c1e514159006aaf6a5c485e53692
...
148
149
150
151
 
152
153
154
...
148
149
150
 
151
152
153
154
0
@@ -148,7 +148,7 @@ module Prawn
0
         renderable_data.each do |row|
0
           row.each_with_index do |cell,i|
0
             length = cell.lines.map { |e| 
0
-              @document.font_metrics.string_width(e,@font_size) }.max +
0
+              @document.font_metrics.string_width(e,@font_size) }.max.to_f +
0
                 2*@horizontal_padding
0
             @col_widths[i] = length if length > @col_widths[i]
0
           end
...
128
129
130
 
 
 
 
 
 
 
 
131
132
...
128
129
130
131
132
133
134
135
136
137
138
139
140
0
@@ -128,5 +128,13 @@ describe "A table's content" do
0
     output.strings.should == headers + data.flatten[0..-3] + headers +
0
       data.flatten[-2..-1]
0
   end
0
+
0
+  it "should allow empty fields" do
0
+    lambda {
0
+      data = [["foo","bar"],["baz",""]]
0
+      @pdf = Prawn::Document.new
0
+      @pdf.table(data)
0
+    }.should_not raise_error
0
+  end
0
     
0
 end

Comments