class Asciidoctor::Diagram::StructurizrConverter
@private
Constants
- CLASSPATH_ENV
- CLI_HOME_ENV
- STRUCTURIZR_JARS
Public Instance Methods
collect_options(source)
click to toggle source
# File lib/asciidoctor-diagram/structurizr/converter.rb, line 34 def collect_options(source) { :view => source.attr('view'), :renderer => Renderers.get_renderer_type(source) } end
convert(source, format, options)
click to toggle source
# File lib/asciidoctor-diagram/structurizr/converter.rb, line 41 def convert(source, format, options) unless STRUCTURIZR_JARS raise "Could not load Structurizr. Specify the location of the Structurizr JAR(s) using the 'DIAGRAM_STRUCTURIZRCLI_HOME' or DIAGRAM_STRUCTURIZR_CLASSPATH' environment variable." end Java.load headers = { 'Accept' => Renderers.mime_type(options[:renderer]) } headers['X-Structurizr-View'] = options[:view] if options[:view] headers['X-Structurizr-IncludeDir'] = Platform.native_path(source.base_dir) response = Java.send_request( :url => '/structurizr', :body => source.code, :headers => headers ) unless response[:code] == 200 raise Java.create_error("Structurizr code generation failed", response) end response[:body].force_encoding(Encoding::UTF_8) end
supported_formats()
click to toggle source
# File lib/asciidoctor-diagram/structurizr/converter.rb, line 30 def supported_formats [:txt] end