Prawnto Initializer Block
I'm creating a simple PDF in Rails 3 using Prawn/Prawnto. I'm not sure if my issue is related to Prawnto or if it's just the way i'm doing it. The following code is in my view.
This will successfully output a table:
pdf.table([%w[foo boo], %w[bar baz]])
But I have requirements that I need to inspect certain cells of data and if they match some criteria I must then turn the text red. Now I know the following snippet doesn't describe the requirements but it's an example where I've found out that nothing is evaluated in the initializer block.
Doesn't work
pdf.table([%w[foo boo], %w[bar baz]]) do |t|
t.column(0).width = 200
end
The above snippet开发者_StackOverflow will output my table just like before but the first column isn't 200 width. It seems no matter what I put after the do
it doesn't get evaluated. I've put complete junk and it will still just output my table with no errors or warnings. I've seen examples where this is possible using straight Prawn without the Prawnto plugin but didn't know if this was a limitation of Prawnto or if I'm doing something wrong.
Any ideas what I'm doing wrong?
Seems this syntax isn't supported unless you manually build from git or until the next release: http://groups.google.com/group/prawn-ruby/browse_thread/thread/d52b51b4eac779bb
精彩评论