Class: ZhSieve::HTMLPage

Inherits:
Object
  • Object
show all
Includes:
Converter
Defined in:
lib/zhSieve/htmlpage.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Converter

#answer_to_markdown, #article_to_markdown, #debug, #method_missing, #parse_element, #people_to_markdown, #to_markdown, #wrap_node

Constructor Details

#initialize(options) ⇒ HTMLPage

Returns a new instance of HTMLPage.



7
8
9
10
11
12
# File 'lib/zhSieve/htmlpage.rb', line 7

def initialize(options)
  @contents = options[:contents].body
  @question_id = options[:question_id]
  @answer_id = options[:answer_id]
  @article_id = options[:article_id]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ZhSieve::Converter

Instance Attribute Details

#answer_idObject

Returns the value of attribute answer_id.



5
6
7
# File 'lib/zhSieve/htmlpage.rb', line 5

def answer_id
  @answer_id
end

#article_idObject

Returns the value of attribute article_id.



5
6
7
# File 'lib/zhSieve/htmlpage.rb', line 5

def article_id
  @article_id
end

#contentsObject

Returns the value of attribute contents.



5
6
7
# File 'lib/zhSieve/htmlpage.rb', line 5

def contents
  @contents
end

#question_idObject

Returns the value of attribute question_id.



5
6
7
# File 'lib/zhSieve/htmlpage.rb', line 5

def question_id
  @question_id
end

Instance Method Details

#answerMarkdownObject



18
19
20
# File 'lib/zhSieve/htmlpage.rb', line 18

def answerMarkdown
  @markdown = answer_to_markdown(@contents,@question_id,@answer_id)
end

#articleMarkdownObject



22
23
24
# File 'lib/zhSieve/htmlpage.rb', line 22

def articleMarkdown
  @markdown = article_to_markdown(@contents,@article_id)
end

#markdownObject



30
31
32
# File 'lib/zhSieve/htmlpage.rb', line 30

def markdown
  @markdown ||= markdown!
end

#markdown!Object



34
35
36
# File 'lib/zhSieve/htmlpage.rb', line 34

def markdown!
  @markdown = to_markdown(@contents)
end

#peopleMarkdownObject



14
15
16
# File 'lib/zhSieve/htmlpage.rb', line 14

def peopleMarkdown
  @markdown = people_to_markdown(@contents)
end

#to_htmlObject



26
27
28
# File 'lib/zhSieve/htmlpage.rb', line 26

def to_html
  @html =  @contents
end