class Prawn::QRCode::Table::Cell

QRCode is a table cell that renders a QR code inside a table. Most users will create a table via the PDF DSL method make_qr_code_cell.

Constants

CELL_OPTS
QR_OPTIONS

Public Class Methods

new(pdf, pos, **options) click to toggle source
Calls superclass method
# File lib/prawn/qrcode/table/cell.rb, line 15
def initialize(pdf, pos, **options)
  super(pdf, pos, options.select { |k, _| CELL_OPTS.include?(k) })
  @margin = 4
  @options = options.reject { |k, _| CELL_OPTS.include?(k) }
  @options.each { |k, v| send("#{k}=", v) }
end

Public Instance Methods

draw_content() click to toggle source
# File lib/prawn/qrcode/table/cell.rb, line 30
def draw_content
  renderer.render(@pdf)
end
natural_content_height() click to toggle source
# File lib/prawn/qrcode/table/cell.rb, line 26
def natural_content_height
  renderer.extent
end
natural_content_width() click to toggle source
# File lib/prawn/qrcode/table/cell.rb, line 22
def natural_content_width
  renderer.extent
end
qr_code() click to toggle source
# File lib/prawn/qrcode/table/cell.rb, line 38
def qr_code
  @qr_code = Prawn::QRCode.min_qrcode(content, **@options) unless defined?(@qr_code)
  @qr_code
end
renderer() click to toggle source
# File lib/prawn/qrcode/table/cell.rb, line 34
def renderer
  @renderer ||= Prawn::QRCode::Renderer.new(qr_code, **@options)
end