Class: Jekyll::Diagrams::BasicBlock

Inherits:
Liquid::Block
  • Object
show all
Defined in:
lib/jekyll-diagrams/basic_block.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.rendererObject



6
7
8
9
10
# File 'lib/jekyll-diagrams/basic_block.rb', line 6

def self.renderer
  @renderer ||= const_get(renderer_name)
rescue NameError => error
  raise Errors::RendererNotFoundError, error.message.split(' ').last
end

.renderer_nameObject



12
13
14
# File 'lib/jekyll-diagrams/basic_block.rb', line 12

def self.renderer_name
  @renderer_name ||= name.sub(/Block$/, 'Renderer')
end

Instance Method Details

#render(context) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/jekyll-diagrams/basic_block.rb', line 16

def render(context)
  self.class.renderer.render(
    context, super.to_s, {
      diagram_name: self.class.name.split('::').last
                        .sub(/Block$/, '').downcase
    }
  )
rescue Errors::RendererNotFoundError => error
  Utils.handle_error(context, error)
end