Conditional Formatting in Prawn

237 Views Asked by At

Is it possible to utilize conditional formatting in Prawn? For example, would I be able to check the return value from a form and either output a "Yes" or "No" based on its result? Say it looked like the following in my pdf class.

def method
   text "Approved?" + #resultHere
end

Is something like this achievable?

1

There are 1 best solutions below

0
On

Fixed it. Something like the following should work. I guess I just hit a wall and didn't notice the obvious.

def method
   if @form.attribute
     text "You answered: Yes"
   else
     text "You answered: No"
   end
 end