Class: Moodle2CC::Moodle2::Parsers::QuestionParsers::MatchParser

Inherits:
QuestionParser
  • Object
show all
Includes:
ParserHelper
Defined in:
lib/moodle2cc/moodle2/parsers/question_parsers/match_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



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/moodle2cc/moodle2/parsers/question_parsers/match_parser.rb', line 7

def parse_question(node)
  question = super(node, 'match')

  q_node = node.at_xpath("plugin_qtype_#{question.qtype}_question")

  q_node.search('matches/match').each do |m_node|
    question.matches << {
      :id => m_node.attributes['id'].value,
      :question_text => parse_text(m_node, 'questiontext'),
      :question_text_format => parse_text(m_node, 'questiontextformat'),
      :answer_text => parse_text(m_node, 'answertext')
    }
  end

  question
end