Class: Prawn::Markup::Builders::ListBuilder

Inherits:
NestableBuilder show all
Defined in:
lib/prawn/markup/builders/list_builder.rb

Constant Summary collapse

BULLET_CHAR =
''
BULLET_MARGIN =
10
CONTENT_MARGIN =
10
VERTICAL_MARGIN =
5

Constants inherited from NestableBuilder

NestableBuilder::TEXT_STYLE_OPTIONS

Instance Method Summary collapse

Constructor Details

#initialize(pdf, list, total_width, options = {}) ⇒ ListBuilder

Returns a new instance of ListBuilder.



12
13
14
15
16
# File 'lib/prawn/markup/builders/list_builder.rb', line 12

def initialize(pdf, list, total_width, options = {})
  super(pdf, total_width, options)
  @list = list
  @column_widths = compute_column_widths
end

Instance Method Details

#drawObject



26
27
28
29
30
31
# File 'lib/prawn/markup/builders/list_builder.rb', line 26

def draw
  # fix https://github.com/prawnpdf/prawn-table/issues/120
  pdf.font_size(column_cell_style(:content)[:size] || pdf.font_size) do
    make(true).draw
  end
end

#make(main = false) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/prawn/markup/builders/list_builder.rb', line 18

def make(main = false)
  pdf.make_table(convert_list, list_table_options) do |t|
    t.columns(0).style(column_cell_style(:bullet))
    t.columns(1).style(column_cell_style(:content))
    set_paddings(t, main)
  end
end