Class: Docbook::Output::Builder
- Inherits:
-
Object
- Object
- Docbook::Output::Builder
- Defined in:
- lib/docbook/output/builder.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#xml_path ⇒ Object
readonly
Returns the value of attribute xml_path.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(xml_path:, output_path:, format: :inline, **options) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(xml_path:, output_path:, format: :inline, **options) ⇒ Builder
Returns a new instance of Builder.
8 9 10 11 12 13 |
# File 'lib/docbook/output/builder.rb', line 8 def initialize(xml_path:, output_path:, format: :inline, **) @xml_path = xml_path @output_path = output_path @format = format @options = end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
6 7 8 |
# File 'lib/docbook/output/builder.rb', line 6 def format @format end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/docbook/output/builder.rb', line 6 def @options end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
6 7 8 |
# File 'lib/docbook/output/builder.rb', line 6 def output_path @output_path end |
#xml_path ⇒ Object (readonly)
Returns the value of attribute xml_path.
6 7 8 |
# File 'lib/docbook/output/builder.rb', line 6 def xml_path @xml_path end |
Instance Method Details
#build ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/docbook/output/builder.rb', line 15 def build pipeline = Pipeline.new( xml_path: @xml_path, image_search_dirs: @options[:image_search_dirs] || [], image_strategy: @options[:image_strategy] || :data_url, sort_glossary: @options[:sort_glossary] || false, title: @options[:title] || File.basename(@xml_path, ".*"), ) guide = pipeline.process format_class = Formats::FORMAT_MAP[@format] raise ArgumentError, "Unknown format: #{@format}" unless format_class formatter = format_class.new(dist_dir: @options[:dist_dir]) formatter.write(@output_path, guide, title: @options[:title]) @output_path end |