Class: MarkdownToWord::Document
- Inherits:
-
Object
- Object
- MarkdownToWord::Document
- Defined in:
- lib/markdown_to_word/document.rb
Constant Summary collapse
- YAML_FRONT_MATTER_REGEXP =
/\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
Instance Attribute Summary collapse
-
#html ⇒ Object
Returns the value of attribute html.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
- #contents ⇒ Object
- #hash ⇒ Object
-
#initialize(markdown = "") ⇒ Document
constructor
A new instance of Document.
- #markdown ⇒ Object
Constructor Details
#initialize(markdown = "") ⇒ Document
9 10 11 |
# File 'lib/markdown_to_word/document.rb', line 9 def initialize(markdown="") @raw_markdown = markdown end |
Instance Attribute Details
#html ⇒ Object
Returns the value of attribute html.
4 5 6 |
# File 'lib/markdown_to_word/document.rb', line 4 def html @html end |
#template ⇒ Object
Returns the value of attribute template.
4 5 6 |
# File 'lib/markdown_to_word/document.rb', line 4 def template @template end |
Instance Method Details
#contents ⇒ Object
25 26 27 |
# File 'lib/markdown_to_word/document.rb', line 25 def contents @contents ||= Htmltoword::Document.create(html, template, true) end |
#hash ⇒ Object
21 22 23 |
# File 'lib/markdown_to_word/document.rb', line 21 def hash @hash ||= Digest::MD5.hexdigest(html) end |
#markdown ⇒ Object
13 14 15 |
# File 'lib/markdown_to_word/document.rb', line 13 def markdown @raw_markdown.split(YAML_FRONT_MATTER_REGEXP).last end |