Module: Asciidoctor::Diagram::Extensions::DiagramSource
- Included in:
- BasicSource, ReaderSource
- Defined in:
- lib/asciidoctor-diagram/extensions.rb
Overview
This module describes the duck-typed interface that diagram sources must implement. Implementations may include this module but it is not required.
Instance Method Summary collapse
-
#code ⇒ String
abstract
The String representation of the source code for the diagram.
-
#create_image_metadata ⇒ Hash
Creates an image metadata Hash that will be stored to disk alongside the generated image file.
-
#image_name ⇒ String
abstract
The base name for the image file that will be produced.
-
#should_process?(image_file, image_metadata) ⇒ Boolean
Determines if the diagram should be regenerated or not.
-
#to_s ⇒ Object
Alias for code.
Instance Method Details
#code ⇒ String
Returns the String representation of the source code for the diagram.
283 284 285 |
# File 'lib/asciidoctor-diagram/extensions.rb', line 283 def code raise NotImplementedError.new end |
#create_image_metadata ⇒ Hash
Creates an image metadata Hash that will be stored to disk alongside the generated image file. The contents of this Hash are reread during subsequent document processing and then passed to the should_process? method where it can be used to determine if the diagram should be regenerated or not. The default implementation returns an empty Hash.
307 308 309 |
# File 'lib/asciidoctor-diagram/extensions.rb', line 307 def {} end |
#image_name ⇒ String
Returns the base name for the image file that will be produced.
277 278 279 |
# File 'lib/asciidoctor-diagram/extensions.rb', line 277 def image_name raise NotImplementedError.new end |
#should_process?(image_file, image_metadata) ⇒ Boolean
Determines if the diagram should be regenerated or not. The default implementation of this method simply returns true.
298 299 300 |
# File 'lib/asciidoctor-diagram/extensions.rb', line 298 def should_process?(image_file, ) true end |
#to_s ⇒ Object
Alias for code
288 289 290 |
# File 'lib/asciidoctor-diagram/extensions.rb', line 288 def to_s code end |