Class: Moodle2CC::Moodle2::Parsers::QuestionParsers::MultichoiceParser

Inherits:
QuestionParser
  • Object
show all
Includes:
ParserHelper
Defined in:
lib/moodle2cc/moodle2/parsers/question_parsers/multichoice_parser.rb

Constant Summary

Constants included from ParserHelper

ParserHelper::FILES_XML, ParserHelper::IMS_FILEBASE_TOKEN, ParserHelper::MODULE_XML, ParserHelper::MOODLE_FILEBASE_TOKEN, ParserHelper::SLASH_TOKEN, ParserHelper::XML_NULL_VALUE

Instance Method Summary collapse

Methods included from ParserHelper

#activity_directories, #parse_boolean, #parse_module, #parse_text

Methods inherited from QuestionParser

parse, register_parser_type

Instance Method Details

#parse_question(node) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/moodle2cc/moodle2/parsers/question_parsers/multichoice_parser.rb', line 6

def parse_question(node)
  question = super

  answer_parser = Parsers::AnswerParser.new
  question.answers += node.search('answers/answer').map { |n| answer_parser.parse(n) }

  question.single = parse_boolean(node, 'plugin_qtype_multichoice_question/multichoice/single')

  question
end