class Prawn::Table
def with_position
:position option, and yields.
Sets up a bounding box to position the table according to the specified
def with_position x = case defined?(@position) && @position || :left when :left then return yield when :center then (@pdf.bounds.width - width) / 2.0 when :right then @pdf.bounds.width - width when Numeric then @position else raise ArgumentError, "unknown position #{@position.inspect}" end dy = @pdf.bounds.absolute_top - @pdf.y final_y = nil @pdf.bounding_box([x, @pdf.bounds.top], :width => width) do @pdf.move_down dy yield final_y = @pdf.y end @pdf.y = final_y end