Class: Markbridge::Conversion
- Inherits:
-
Data
- Object
- Data
- Markbridge::Conversion
- Defined in:
- lib/markbridge/conversion.rb
Overview
Result of a *_to_markdown / convert / render call.
Wraps a Parse (the input-side fields: ast, format, unknown_tags, diagnostics) and adds the render-side outputs: markdown and errors. The wrapped Parse is reachable via #parsed, and each of its fields is also exposed as a delegated reader so the common usage stays ergonomic (conversion.ast, conversion.unknown_tags, …) without forcing callers to chain through #parsed.
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#markdown ⇒ Object
readonly
Returns the value of attribute markdown.
-
#parsed ⇒ Object
readonly
Returns the value of attribute parsed.
Instance Method Summary collapse
-
#ast ⇒ AST::Document
Delegated to Parse#ast.
-
#diagnostics ⇒ Hash{Symbol => Object}
Delegated to Parse#diagnostics.
-
#format ⇒ Symbol?
Delegated to Parse#format.
-
#to_s ⇒ Object
Allows puts result and “text: #{result}” to work seamlessly.
-
#unknown_tags ⇒ Hash{String => Integer}
Delegated to Parse#unknown_tags.
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/markbridge/conversion.rb', line 30 Conversion = Data.define(:parsed, :markdown, :errors) do def ast = parsed.ast def format = parsed.format def = parsed. def diagnostics = parsed.diagnostics # Allows +puts result+ and +"text: #{result}"+ to work seamlessly. def to_s = markdown end |
#markdown ⇒ Object (readonly)
Returns the value of attribute markdown
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/markbridge/conversion.rb', line 30 Conversion = Data.define(:parsed, :markdown, :errors) do def ast = parsed.ast def format = parsed.format def = parsed. def diagnostics = parsed.diagnostics # Allows +puts result+ and +"text: #{result}"+ to work seamlessly. def to_s = markdown end |
#parsed ⇒ Object (readonly)
Returns the value of attribute parsed
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/markbridge/conversion.rb', line 30 Conversion = Data.define(:parsed, :markdown, :errors) do def ast = parsed.ast def format = parsed.format def = parsed. def diagnostics = parsed.diagnostics # Allows +puts result+ and +"text: #{result}"+ to work seamlessly. def to_s = markdown end |
Instance Method Details
#ast ⇒ AST::Document
Returns delegated to Parse#ast.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/markbridge/conversion.rb', line 30 Conversion = Data.define(:parsed, :markdown, :errors) do def ast = parsed.ast def format = parsed.format def = parsed. def diagnostics = parsed.diagnostics # Allows +puts result+ and +"text: #{result}"+ to work seamlessly. def to_s = markdown end |
#diagnostics ⇒ Hash{Symbol => Object}
Returns delegated to Parse#diagnostics.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/markbridge/conversion.rb', line 30 Conversion = Data.define(:parsed, :markdown, :errors) do def ast = parsed.ast def format = parsed.format def = parsed. def diagnostics = parsed.diagnostics # Allows +puts result+ and +"text: #{result}"+ to work seamlessly. def to_s = markdown end |
#format ⇒ Symbol?
Returns delegated to Parse#format.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/markbridge/conversion.rb', line 30 Conversion = Data.define(:parsed, :markdown, :errors) do def ast = parsed.ast def format = parsed.format def = parsed. def diagnostics = parsed.diagnostics # Allows +puts result+ and +"text: #{result}"+ to work seamlessly. def to_s = markdown end |
#to_s ⇒ Object
Allows puts result and “text: #{result}” to work seamlessly.
38 |
# File 'lib/markbridge/conversion.rb', line 38 def to_s = markdown |
#unknown_tags ⇒ Hash{String => Integer}
Returns delegated to Parse#unknown_tags.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/markbridge/conversion.rb', line 30 Conversion = Data.define(:parsed, :markdown, :errors) do def ast = parsed.ast def format = parsed.format def = parsed. def diagnostics = parsed.diagnostics # Allows +puts result+ and +"text: #{result}"+ to work seamlessly. def to_s = markdown end |