Class: GithubToCanvasQuiz::Parser::Markdown::Answer::Base
- Inherits:
-
Object
- Object
- GithubToCanvasQuiz::Parser::Markdown::Answer::Base
- Includes:
- Helpers::NodeParser
- Defined in:
- lib/github_to_canvas_quiz/parser/markdown/answer/base.rb
Direct Known Subclasses
FillInMultipleBlanks, Matching, MultipleAnswers, MultipleChoice, MultipleDropdowns, ShortAnswer, TrueFalse
Instance Attribute Summary collapse
-
#answer_nodes ⇒ Object
readonly
Returns the value of attribute answer_nodes.
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(title, nodes) ⇒ Base
constructor
A new instance of Base.
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_nodes ⇒ Object (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 |
#comment ⇒ Object (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 |
#title ⇒ Object (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 |