Class: Markdownator::Result

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

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
   =  || {}
end

Instance Attribute Details

#markdownString (readonly) Also known as: text_content

Returns the value of attribute markdown.

Returns:

  • (String)


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

def markdown
  @markdown
end

#metadataHash[untyped, untyped] (readonly)

Returns the value of attribute metadata.

Returns:

  • (Hash[untyped, untyped])


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

def 
  
end

#titleString? (readonly)

Returns the value of attribute title.

Returns:

  • (String, nil)


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

def title
  @title
end

Instance Method Details

#to_sString

Returns:

  • (String)


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

def to_s
  markdown
end