Class: Markdownator::Result
- Inherits:
-
Object
- Object
- Markdownator::Result
- Defined in:
- lib/markdownator/result.rb
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 ⇒ Object
(also: #text_content)
readonly
Returns the value of attribute markdown.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#title ⇒ Object
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 ⇒ Object
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 @metadata = || {} end |
Instance Attribute Details
#markdown ⇒ Object (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 ⇒ Object (readonly)
Returns the value of attribute metadata.
9 10 11 |
# File 'lib/markdownator/result.rb', line 9 def @metadata end |
#title ⇒ Object (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 ⇒ Object
17 18 19 |
# File 'lib/markdownator/result.rb', line 17 def to_s markdown end |