Class: Markdownator::Result

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#markdownObject (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

#metadataObject (readonly)

Returns the value of attribute metadata.



9
10
11
# File 'lib/markdownator/result.rb', line 9

def 
  @metadata
end

#titleObject (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_sObject



17
18
19
# File 'lib/markdownator/result.rb', line 17

def to_s
  markdown
end