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

#create_image_metadata, #image_name, #should_process?, #to_s

Methods inherited from BasicSource

#checksum, #compute_checksum, #create_image_metadata, #image_name, #should_process?

Constructor Details

#initialize(reader, attributes) ⇒ ReaderSource

Returns a new instance of ReaderSource.



339
340
341
342
# File 'lib/asciidoctor-diagram/extensions.rb', line 339

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

Instance Method Details

#codeObject



344
345
346
# File 'lib/asciidoctor-diagram/extensions.rb', line 344

def code
  @code ||= @reader.lines.join("\n")
end