Class: Asciidoctor::Chart::ChartBlock

Inherits:
Block
  • Object
show all
Defined in:
lib/asciidoctor/chart/chart_block.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, data, attrs) ⇒ ChartBlock

Returns a new instance of ChartBlock.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/asciidoctor/chart/chart_block.rb', line 6

def initialize(parent, data, attrs)
  engine = parent.document.get_engine attrs
  caption = attrs.delete 'caption'
  title = attrs.delete 'title'
  block_attributes = attrs.merge({
                                   'id' => attrs['id'] || "chart#{PlainRubyRandom.uuid}",
                                   'type' => attrs['type'] || 'line',
                                   'engine' => engine,
                                   'data-raw' => data
                                 })
  super parent, :chart, { source: nil, attributes: block_attributes, subs: nil }
  @title = title
  assign_caption(caption, 'figure')
end