Class: Moodle2CC::Moodle2::Parsers::AnswerParser

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

Instance Method Details

#parse(node) ⇒ Object



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

def parse(node)
  answer = Models::Quizzes::Answer.new
  answer.id = node.at_xpath('@id').value
  answer.answer_text = parse_text(node, 'answertext')
  answer.fraction = parse_text(node, 'fraction').to_r
  answer.feedback = parse_text(node, 'feedback')
  answer.feedback_format = parse_text(node, 'feedbackformat')

  answer
end