Class: Slamdown::Output::Base
- Inherits:
-
Object
- Object
- Slamdown::Output::Base
- Defined in:
- lib/slamdown/output.rb
Overview
Owns the canonical string and conversion-only diagnostics shared by every output format.
Instance Attribute Summary collapse
-
#diagnostics ⇒ Object
readonly
Returns the value of attribute diagnostics.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(output, diagnostics) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(output, diagnostics) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 17 18 |
# File 'lib/slamdown/output.rb', line 11 def initialize(output, diagnostics) raise ArgumentError, "output must be a String" unless output.is_a?(String) raise ArgumentError, "diagnostics must contain only Slamdown diagnostics" unless diagnostics.is_a?(Array) && diagnostics.all? { |diagnostic| diagnostic.is_a?(Diagnostic) } @output = output.dup.freeze @diagnostics = diagnostics.dup.freeze freeze end |
Instance Attribute Details
#diagnostics ⇒ Object (readonly)
Returns the value of attribute diagnostics.
9 10 11 |
# File 'lib/slamdown/output.rb', line 9 def diagnostics @diagnostics end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
9 10 11 |
# File 'lib/slamdown/output.rb', line 9 def output @output end |