Class: Kramdown::PlantUml::PlantUmlResult
- Defined in:
- lib/kramdown-plantuml/plantuml_result.rb
Overview
Executes the PlantUML Java application.
Instance Attribute Summary collapse
-
#exitcode ⇒ Object
readonly
Returns the value of attribute exitcode.
-
#plantuml_diagram ⇒ Object
readonly
Returns the value of attribute plantuml_diagram.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
-
#initialize(plantuml_diagram, stdout, stderr, exitcode) ⇒ PlantUmlResult
constructor
A new instance of PlantUmlResult.
- #svg_diagram ⇒ Object
- #valid? ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize(plantuml_diagram, stdout, stderr, exitcode) ⇒ PlantUmlResult
Returns a new instance of PlantUmlResult.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/kramdown-plantuml/plantuml_result.rb', line 13 def initialize(plantuml_diagram, stdout, stderr, exitcode) raise ArgumentError, 'diagram cannot be nil' if plantuml_diagram.nil? raise ArgumentError, "diagram must be a #{PlantUmlDiagram}" unless plantuml_diagram.is_a?(PlantUmlDiagram) raise ArgumentError, 'exitcode cannot be nil' if exitcode.nil? raise ArgumentError, "exitcode must be a #{Integer}" unless exitcode.is_a?(Integer) @plantuml_diagram = plantuml_diagram @stdout = stdout @stderr = stderr @exitcode = exitcode @logger = LogWrapper.init end |
Instance Attribute Details
#exitcode ⇒ Object (readonly)
Returns the value of attribute exitcode.
11 12 13 |
# File 'lib/kramdown-plantuml/plantuml_result.rb', line 11 def exitcode @exitcode end |
#plantuml_diagram ⇒ Object (readonly)
Returns the value of attribute plantuml_diagram.
11 12 13 |
# File 'lib/kramdown-plantuml/plantuml_result.rb', line 11 def plantuml_diagram @plantuml_diagram end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
11 12 13 |
# File 'lib/kramdown-plantuml/plantuml_result.rb', line 11 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
11 12 13 |
# File 'lib/kramdown-plantuml/plantuml_result.rb', line 11 def stdout @stdout end |
Instance Method Details
#svg_diagram ⇒ Object
26 27 28 |
# File 'lib/kramdown-plantuml/plantuml_result.rb', line 26 def svg_diagram @plantuml_diagram.svg end |
#valid? ⇒ Boolean
30 31 32 33 34 35 36 37 |
# File 'lib/kramdown-plantuml/plantuml_result.rb', line 30 def valid? return true if @exitcode.zero? || @stderr.nil? || @stderr.empty? # If stderr is not empty, but contains the string 'CoreText note:', # the error is caused by a bug in Java, and should be ignored. # Circumvents https://bugs.openjdk.java.net/browse/JDK-8244621 @stderr.include?('CoreText note:') end |
#validate! ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/kramdown-plantuml/plantuml_result.rb', line 39 def validate! raise PlantUmlError, self unless valid? return if @stderr.nil? || @stderr.empty? @logger.debug 'PlantUML log:' @logger.debug_multiline @stderr end |