Class: Asciidoctor::Diagram::Extensions::ReaderSource

Inherits:
BasicSource
  • Object
show all
Includes:
DiagramSource
Defined in:
lib/asciidoctor-diagram/extensions.rb

Overview

A diagram source that retrieves the code for the diagram from the contents of a block.

Instance Attribute Summary

Attributes inherited from BasicSource

#attributes

Instance Method Summary collapse

Methods included from DiagramSource

#attr, #base_dir, #create_image_metadata, #image_name, #should_process?, #to_s

Methods inherited from BasicSource

#attr, #checksum, #create_image_metadata, #image_name, #should_process?

Constructor Details

#initialize(parent_block, reader, attributes) ⇒ ReaderSource

Returns a new instance of ReaderSource.



476
477
478
479
# File 'lib/asciidoctor-diagram/extensions.rb', line 476

def initialize(parent_block, reader, attributes)
  super(parent_block, attributes)
  @reader = reader
end

Instance Method Details

#codeObject



481
482
483
# File 'lib/asciidoctor-diagram/extensions.rb', line 481

def code
  @code ||= @parent_block.apply_subs(@reader.lines, resolve_diagram_subs).join("\n")
end