Class: AutoPilot::MarkdownConverter

Inherits:
Object
  • Object
show all
Includes:
TemplateHelper
Defined in:
lib/auto_pilot/markdown_converter.rb

Constant Summary collapse

DEFAULT_BLOG_FOLDER =
'./stackoverflow'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TemplateHelper

#file_name, #make_folder_if_doesnt_exist, #parameterize, #write_file_to_disk

Constructor Details

#initialize(doc) ⇒ MarkdownConverter

Returns a new instance of MarkdownConverter.



11
12
13
14
15
16
17
# File 'lib/auto_pilot/markdown_converter.rb', line 11

def initialize(doc)
  @h1_tag   = to_markdown doc.title_html
  @question = to_markdown doc.question_html
  @answer   = to_markdown doc.answer_html
  make_folder_if_doesnt_exist
  write_file_to_disk(AutoPilot.configuration.folder, :md)
end

Instance Attribute Details

#answerObject (readonly)

Returns the value of attribute answer.



7
8
9
# File 'lib/auto_pilot/markdown_converter.rb', line 7

def answer
  @answer
end

#docObject (readonly)

Returns the value of attribute doc.



7
8
9
# File 'lib/auto_pilot/markdown_converter.rb', line 7

def doc
  @doc
end

#h1_tagObject (readonly)

Returns the value of attribute h1_tag.



7
8
9
# File 'lib/auto_pilot/markdown_converter.rb', line 7

def h1_tag
  @h1_tag
end

#questionObject (readonly)

Returns the value of attribute question.



7
8
9
# File 'lib/auto_pilot/markdown_converter.rb', line 7

def question
  @question
end