Class: DrawioDsl::XmlBuilder

Inherits:
Object
  • Object
show all
Includes:
KLog::Logging
Defined in:
lib/drawio_dsl/xml_builder.rb

Overview

Build the DrawioDsl XML file that is the basis of any draw-io diagrams.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(diagram) ⇒ XmlBuilder

Returns a new instance of XmlBuilder.



10
11
12
# File 'lib/drawio_dsl/xml_builder.rb', line 10

def initialize(diagram)
  @diagram = diagram
end

Instance Attribute Details

#diagramObject (readonly)

Returns the value of attribute diagram.



8
9
10
# File 'lib/drawio_dsl/xml_builder.rb', line 8

def diagram
  @diagram
end

Instance Method Details

#buildObject



14
15
16
17
18
19
# File 'lib/drawio_dsl/xml_builder.rb', line 14

def build
  xml_builder = Nokogiri::XML::Builder.new do |xml|
    build_diagram(xml)
  end
  xml_builder.to_xml.sub('<?xml version="1.0"?>', '').strip
end