Class: Markdownator::Result
- Inherits:
-
Object
- Object
- Markdownator::Result
- Defined in:
- lib/markdownator/result.rb,
sig/markdownator.rbs
Overview
The result of a conversion: the produced Markdown plus optional metadata.
#to_s and #text_content both return the Markdown so the result is
convenient to print or interpolate.
Instance Attribute Summary collapse
-
#markdown ⇒ String
(also: #text_content)
readonly
Returns the value of attribute markdown.
-
#metadata ⇒ Hash[untyped, untyped]
readonly
Returns the value of attribute metadata.
-
#title ⇒ String?
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(markdown:, title: nil, metadata: {}) ⇒ Result
constructor
A new instance of Result.
- #to_s ⇒ String
Constructor Details
#initialize(markdown:, title: nil, metadata: {}) ⇒ Result
Returns a new instance of Result.
11 12 13 14 15 |
# File 'lib/markdownator/result.rb', line 11 def initialize(markdown:, title: nil, metadata: {}) @markdown = markdown.to_s @title = title = || {} end |
Instance Attribute Details
#markdown ⇒ String (readonly) Also known as: text_content
Returns the value of attribute markdown.
9 10 11 |
# File 'lib/markdownator/result.rb', line 9 def markdown @markdown end |
#metadata ⇒ Hash[untyped, untyped] (readonly)
Returns the value of attribute metadata.
9 10 11 |
# File 'lib/markdownator/result.rb', line 9 def end |
#title ⇒ String? (readonly)
Returns the value of attribute title.
9 10 11 |
# File 'lib/markdownator/result.rb', line 9 def title @title end |
Instance Method Details
#to_s ⇒ String
17 18 19 |
# File 'lib/markdownator/result.rb', line 17 def to_s markdown end |