Class: Asciidoctor::Diagram::ReaderSource

Inherits:
BasicSource
  • Object
show all
Includes:
DiagramSource
Defined in:
lib/asciidoctor-diagram/diagram_source.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, #code, #config, #create_image_metadata, #diagram_type, #ensure_gem, #find_command, #global_attr, #global_opt, #image_name, #opt, #resolve_path, #should_process?, #to_s

Methods inherited from BasicSource

#attr, #checksum, #config, #create_image_metadata, #diagram_type, #image_name, #resolve_path, #should_process?

Constructor Details

#initialize(block_processor, parent_block, reader, attributes) ⇒ ReaderSource

Returns a new instance of ReaderSource.



268
269
270
271
# File 'lib/asciidoctor-diagram/diagram_source.rb', line 268

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

Instance Method Details

#load_codeObject



273
274
275
# File 'lib/asciidoctor-diagram/diagram_source.rb', line 273

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