class LiquidDiagrams::BasicRenderer

@abstract Subclass and override {#render} to implement.

Constants

FLAGS

Configuration key for argument with boolean value.

FLAGS_PREFIX

Prefix for {FLAGS}

OPTIONS

Configuration key for argument with key-value pairs.

OPTIONS_PREFIX

Prefix for {OPTIONS}

OPTIONS_SEPARATOR

Separator for key and value of {OPTIONS}.

Public Class Methods

new(content, options = {}) click to toggle source
# File lib/liquid_diagrams/basic_renderer.rb, line 27
def initialize(content, options = {})
  @content = content
  @config = options
end
render(content, options = {}) click to toggle source
# File lib/liquid_diagrams/basic_renderer.rb, line 23
def self.render(content, options = {})
  new(content, options).render
end

Public Instance Methods

arguments() click to toggle source
# File lib/liquid_diagrams/basic_renderer.rb, line 47
def arguments
  flags = Utils.build_flags(
    @config, self.class.const_get(:FLAGS),
    prefix: self.class.const_get(:FLAGS_PREFIX)
  )
  options = Utils.build_options(
    @config, self.class.const_get(:OPTIONS),
    prefix: self.class.const_get(:OPTIONS_PREFIX),
    sep: self.class.const_get(:OPTIONS_SEPARATOR)
  )

  "#{flags} #{options}".strip
end
build_command() click to toggle source
# File lib/liquid_diagrams/basic_renderer.rb, line 39
def build_command
  "#{executable} #{arguments}".strip
end
executable() click to toggle source
# File lib/liquid_diagrams/basic_renderer.rb, line 43
def executable
  self.class.name.split('::').last.sub(/Renderer$/, '').downcase
end
render() click to toggle source

Default render method with {Errors::NotImplementedError} raised

@important You should overrite this method in your own renderer class

# File lib/liquid_diagrams/basic_renderer.rb, line 35
def render
  raise Errors::NotImplementedError
end