class Senkyoshi::JumbledSentence
Public Class Methods
new()
click to toggle source
Calls superclass method
Senkyoshi::Question::new
# File lib/senkyoshi/models/questions/jumbled_sentence.rb, line 20 def initialize @responses = [] super end
Public Instance Methods
canvas_conversion(assessment, _resources = nil)
click to toggle source
Calls superclass method
Senkyoshi::Question#canvas_conversion
# File lib/senkyoshi/models/questions/jumbled_sentence.rb, line 49 def canvas_conversion(assessment, _resources = nil) @question.responses = @responses super end
iterate_xml(data)
click to toggle source
Calls superclass method
Senkyoshi::Question#iterate_xml
# File lib/senkyoshi/models/questions/jumbled_sentence.rb, line 25 def iterate_xml(data) super if response_block = data.at("flow[@class=RESPONSE_BLOCK]") choices = [] response_block.at("flow_label").children.each do |response| text = response.at("mattext").text choices << { id: response.attributes["ident"], text: text } end set_answers(data.at("resprocessing")) correct = data.at("respcondition[title=correct]") correct.at("and").children.each do |answer_element| id = answer_element.text response_label = data.at("response_label[ident='#{id}']") answer_text = response_label.at("mattext").text answer = Answer.new(answer_text, id) resp_ident = answer_element.attributes["respident"].value answer.resp_ident = resp_ident @responses << { id: resp_ident, choices: choices } @answers.push(answer) end end self end