Class: LiquidDiagrams::BasicRenderer Abstract
- Inherits:
-
Object
- Object
- LiquidDiagrams::BasicRenderer
- Includes:
- Rendering
- Defined in:
- lib/liquid_diagrams/basic_renderer.rb
Overview
Subclass and override #render to implement.
Direct Known Subclasses
Renderers::BitfieldRenderer, Renderers::ErdRenderer, Renderers::GraphvizRenderer, Renderers::MermaidRenderer, Renderers::NetlistsvgRenderer, Renderers::NomnomlRenderer, Renderers::PlantumlRenderer, Renderers::SmcatRenderer, Renderers::SvgbobRenderer, Renderers::SyntraxRenderer, Renderers::VegaRenderer, Renderers::VegaliteRenderer, Renderers::WavedromRenderer
Constant Summary collapse
- FLAGS =
Configuration key for argument with boolean value.
[].freeze
- FLAGS_PREFIX =
Prefix for FLAGS
'--'
- OPTIONS =
Configuration key for argument with key-value pairs.
[].freeze
- OPTIONS_SEPARATOR =
Separator for key and value of OPTIONS.
' '
- OPTIONS_PREFIX =
Prefix for OPTIONS
'--'
Class Method Summary collapse
Instance Method Summary collapse
- #arguments ⇒ Object
- #build_command ⇒ Object
- #executable ⇒ Object
-
#initialize(content, options = {}) ⇒ BasicRenderer
constructor
A new instance of BasicRenderer.
-
#render ⇒ Object
Default render method with Errors::NotImplementedError raised.
Methods included from Rendering
render_with_command, render_with_stdin_stdout, render_with_tempfile
Constructor Details
#initialize(content, options = {}) ⇒ BasicRenderer
Returns a new instance of BasicRenderer.
27 28 29 30 |
# File 'lib/liquid_diagrams/basic_renderer.rb', line 27 def initialize(content, = {}) @content = content @config = end |
Class Method Details
.render(content, options = {}) ⇒ Object
23 24 25 |
# File 'lib/liquid_diagrams/basic_renderer.rb', line 23 def self.render(content, = {}) new(content, ).render end |
Instance Method Details
#arguments ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# 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) ) = Utils.( @config, self.class.const_get(:OPTIONS), prefix: self.class.const_get(:OPTIONS_PREFIX), sep: self.class.const_get(:OPTIONS_SEPARATOR) ) "#{flags} #{}".strip end |
#build_command ⇒ Object
39 40 41 |
# File 'lib/liquid_diagrams/basic_renderer.rb', line 39 def build_command "#{executable} #{arguments}".strip end |
#executable ⇒ Object
43 44 45 |
# File 'lib/liquid_diagrams/basic_renderer.rb', line 43 def executable self.class.name.split('::').last.sub(/Renderer$/, '').downcase end |
#render ⇒ Object
Default render method with Errors::NotImplementedError raised
35 36 37 |
# File 'lib/liquid_diagrams/basic_renderer.rb', line 35 def render raise Errors::NotImplementedError end |