Class: GithubToCanvasQuiz::Parser::Markdown::Question

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

Instance Attribute Summary

Attributes inherited from Base

#frontmatter, #markdown

Instance Method Summary collapse

Methods included from Helpers::NodeParser

#parse_text_from_node, #parse_text_from_nodes

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from GithubToCanvasQuiz::Parser::Markdown::Base

Instance Method Details

#parseObject

Parse the frontmatter/HTML from the Markdown document and return a Question and its associated Answers



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/github_to_canvas_quiz/parser/markdown/question.rb', line 10

def parse
  Model::Question.new(
    course_id: frontmatter['course_id'],
    quiz_id: frontmatter['quiz_id'],
    id: frontmatter['id'],
    type: frontmatter['type'],
    sources: frontmatter['sources'],
    name: name,
    description: description,
    answers: answers,
    distractors: distractors
  )
end