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

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

Constant Summary collapse

BULLET_CHAR =
''.freeze
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.



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

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

Instance Method Details

#drawObject



24
25
26
# File 'lib/prawn/markup/builders/list_builder.rb', line 24

def draw
  make(true).draw
end

#make(main = false) ⇒ Object



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

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