Class: Asciidoctor::Diagram::ErdConverter

Inherits:
Object
  • Object
show all
Includes:
CliGenerator, DiagramConverter
Defined in:
lib/asciidoctor-diagram/erd/converter.rb

Instance Method Summary collapse

Methods included from CliGenerator

#generate_file, #generate_file_stdout, #generate_stdin, #generate_stdin_file, #generate_stdin_stdout

Methods included from DiagramConverter

#collect_options, #native_scaling?, #wrap_source

Instance Method Details

#convert(source, format, options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/asciidoctor-diagram/erd/converter.rb', line 17

def convert(source, format, options)
  erd_path = source.find_command('erd')
  dot_path = source.find_command('dot', :alt_attrs => ['graphvizdot'])

  dot_code = generate_stdin(erd_path, format.to_s, source.to_s) do |tool_path, output_path|
    [tool_path, '-o', Platform.native_path(output_path), '-f', 'dot']
  end

  generate_stdin(dot_path, format.to_s, dot_code) do |tool_path, output_path|
    [tool_path, "-o#{Platform.native_path(output_path)}", "-T#{format.to_s}"]
  end
end

#supported_formatsObject



13
14
15
# File 'lib/asciidoctor-diagram/erd/converter.rb', line 13

def supported_formats
  [:png, :svg]
end