Class: Slamdown::Conversion::Normalisation
- Inherits:
-
Object
- Object
- Slamdown::Conversion::Normalisation
- Defined in:
- lib/slamdown/conversion/normalisation.rb
Overview
Carries the immutable normalised conversion tree together with the corrective diagnostics produced while building it.
Instance Attribute Summary collapse
-
#diagnostics ⇒ Object
readonly
Returns the value of attribute diagnostics.
-
#tree ⇒ Object
readonly
Returns the value of attribute tree.
Instance Method Summary collapse
-
#initialize(tree, diagnostics) ⇒ Normalisation
constructor
A new instance of Normalisation.
Constructor Details
#initialize(tree, diagnostics) ⇒ Normalisation
Returns a new instance of Normalisation.
10 11 12 13 14 15 16 17 |
# File 'lib/slamdown/conversion/normalisation.rb', line 10 def initialize(tree, diagnostics) raise ArgumentError, "tree must be a normalised Slamdown node" unless tree.is_a?(NormalisedNode) raise ArgumentError, "diagnostics must contain only Slamdown diagnostics" unless diagnostics.is_a?(Array) && diagnostics.all? { |diagnostic| diagnostic.is_a?(Diagnostic) } @tree = tree @diagnostics = diagnostics.dup.freeze freeze end |
Instance Attribute Details
#diagnostics ⇒ Object (readonly)
Returns the value of attribute diagnostics.
8 9 10 |
# File 'lib/slamdown/conversion/normalisation.rb', line 8 def diagnostics @diagnostics end |
#tree ⇒ Object (readonly)
Returns the value of attribute tree.
8 9 10 |
# File 'lib/slamdown/conversion/normalisation.rb', line 8 def tree @tree end |