Class: GithubToCanvasQuiz::Parser::Markdown::Answer::Base

Inherits:
Object
  • Object
show all
Includes:
Helpers::NodeParser
Defined in:
lib/github_to_canvas_quiz/parser/markdown/answer/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::NodeParser

#parse_text_from_node, #parse_text_from_nodes

Constructor Details

#initialize(title, nodes) ⇒ Base

Returns a new instance of Base.



12
13
14
15
16
17
# File 'lib/github_to_canvas_quiz/parser/markdown/answer/base.rb', line 12

def initialize(title, nodes)
  @title = title
  scanner = Helpers::NodeScanner.new(nodes)
  @answer_nodes = scanner.scan_before('blockquote') || scanner.scan_rest
  @comment = scanner.eof? ? '' : scanner.scan_rest.first.inner_html.strip
end

Instance Attribute Details

#answer_nodesObject (readonly)

Returns the value of attribute answer_nodes.



10
11
12
# File 'lib/github_to_canvas_quiz/parser/markdown/answer/base.rb', line 10

def answer_nodes
  @answer_nodes
end

#commentObject (readonly)

Returns the value of attribute comment.



10
11
12
# File 'lib/github_to_canvas_quiz/parser/markdown/answer/base.rb', line 10

def comment
  @comment
end

#titleObject (readonly)

Returns the value of attribute title.



10
11
12
# File 'lib/github_to_canvas_quiz/parser/markdown/answer/base.rb', line 10

def title
  @title
end