class Jekyll::Diagrams::ErdRenderer

Constants

CONFIGURATIONS
SWITCHES
XML_REGEX

Public Instance Methods

build_command(config) click to toggle source
# File lib/jekyll-diagrams/erd/renderer.rb, line 19
def build_command(config)
  command = +'erd --fmt=svg'

  SWITCHES.merge(config.slice(*SWITCHES.keys)).each do |switch, value|
    command << " --#{switch}" if value != false
  end

  CONFIGURATIONS.each do |conf|
    command << " --#{conf}=#{config[conf]}" if config.key?(conf)
  end

  command
end
render_svg(code, config) click to toggle source
# File lib/jekyll-diagrams/erd/renderer.rb, line 12
def render_svg(code, config)
  command = build_command(config)

  svg = render_with_stdin_stdout(command, code)
  svg.sub!(XML_REGEX, '')
end