Class: Asciidoctor::Mermaid::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/asciidoctor-mermaid/cli.rb

Class Method Summary collapse

Class Method Details

.run(content, *args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/asciidoctor-mermaid/cli.rb', line 6

def self.run(content, *args)
  stdout, stderr, status =
    Open3.capture3('mmdc', *args, stdin_data: content)

  exit = status.exitstatus

  if exit != 0
    raise "mermaid-cli failed: #{stdout.empty? ? stderr : stdout}"
  end

  stdout
end