Class: Jekyll::Diagrams::BasicRenderer

Inherits:
Object
  • Object
show all
Includes:
Rendering
Defined in:
lib/jekyll-diagrams/basic_renderer.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Rendering

render_with_command, render_with_stdin_stdout, render_with_tempfile

Constructor Details

#initialize(context, content, options = {}) ⇒ BasicRenderer

Returns a new instance of BasicRenderer.



12
13
14
15
16
17
18
# File 'lib/jekyll-diagrams/basic_renderer.rb', line 12

def initialize(context, content, options = {})
  @context = context
  @content = content
  @diagram = options.fetch(:diagram_name) do
    self.class.name.split('::').last.sub(/Renderer$/, '').downcase
  end
end

Class Method Details

.render(context, content, options = {}) ⇒ Object



8
9
10
# File 'lib/jekyll-diagrams/basic_renderer.rb', line 8

def self.render(context, content, options = {})
  new(context, content, options).render
end

Instance Method Details

#renderObject



20
21
22
23
24
25
# File 'lib/jekyll-diagrams/basic_renderer.rb', line 20

def render
  output = render_svg(@content, configuration)
  Utils.wrap_class(output, @diagram)
rescue StandardError => error
  Utils.wrap_class(Utils.handle_error(@context, error), @diagram)
end