Class: Docxtor2::ContentBuilder

Inherits:
ElementList show all
Includes:
BlockEvaluator
Defined in:
lib/docxtor2/content_builder.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BlockEvaluator

#evaluate

Methods inherited from ElementList

map

Constructor Details

#initialize(block) ⇒ ContentBuilder

Returns a new instance of ContentBuilder.



18
19
20
21
# File 'lib/docxtor2/content_builder.rb', line 18

def initialize(block)
  super()
  evaluate &block
end

Class Method Details

.build(&block) ⇒ Object



6
7
8
9
# File 'lib/docxtor2/content_builder.rb', line 6

def build(&block)
  instance = new(block)
  instance.build
end

Instance Method Details

#buildObject



23
24
25
26
27
# File 'lib/docxtor2/content_builder.rb', line 23

def build
  xml = Builder::XmlMarkup.new
  write_elements(xml)
  xml.target!
end